Android Breakout game and Application development

Problem Description:

To create a brick break out game. In the Android Breakout game  the player can be able to break statically located bricks placed on the top of the screen using a ball. The ball keeps on moving from top to bottom. A paddle at the bottom can be used to change the direction of the ball and thus avoid the ball touching the ground.  If the ball touches the ground the player will lose the game but if the player break all the bricks then the player will be a winner.

User’s Guide:

The Android Breakout game is delivered in a zip file called radnim-1_task3.zip. To run the application one must download the file and extract to a folder. Import the folder as an eclipse project (You must have android SDK installed in eclipse).

After fixing the project setup, right click the folder and run as Android Application.

When the application starts it will look like the figure 1. After all bricks are break as shown in fig.2 the player will see a winning message on the screen.
If the ball touches the ground as shown in fig.4 the player will lose the game. However the player can press Play Again to play once again.

Android Breakout game

Algorithm Description

There are 2 activities in the application. “MainActivity” which is loaded as soon as the application start. Another activity is “GameStatusActivity” which is used to display the result of the game (i.e if the player wins or lost).

The “GameView” class contains the main logic related to the creation of bricks, ball and paddle. Each of them is created as an instance of “GameObject”. The “GameObject” has an instance of bitmap and the x, y coordinates. The “GameLogic” controls the status of the game. The game has 3 statuses (Running, Win, and Lost). This class extends the “Thread” class and overrides the run method. The update method in “GameView” has the logic to move the ball to a suitable position depending on the collision with wall, block or paddle.

The collide method in the “GameObject” helps to identify if the ball is collided with other “GameObject” instances. The update method in the “GameObject” updates the x, y position of the ball.

The onTouchEvent of “GameView” handles touch screen motion events.

System Description

Limitations

There are many limitations in terms of look and feel. But one of the major limitation is sometimes the ball does not bounce back when it touch paddle. I tested several times but this occurs rarely and only once. I don’t understand the reason.  Also the ball don’t move horizontally when it touches the middle of any block or paddle. There is something to do with the x, y position of the ball, I tried but didn’t find a solution.

Discussion

Have not been in any discussions with in the forum. As I am very busy usually with my work and most of the conversations are in English. However I do read other students comments and ideas. They are really very helpful. Initially I tried to learn about the game development fundamentals. Later I followed the android forum that is very helpful.

Android Breakout game Diagram

Test runs 

No tests are available to run.

References

  1. http://developer.android.com/resources/samples/LunarLander/index.html
  2. Pro Android Games.
  3. Practical android 4 games development.
  4. Beginning Android 4 Games Development.

Leave a Reply

Your email address will not be published. Required fields are marked *