Our lovely game objects

Like every game, Balls Out! is made out of several objects that may or may not have their own life, of course, only if you code them to have a life. So which objects are part of the game?

Layers

In this game we will use only three layers (groups):

  • Background
  • Game
  • Title screen

The background layer will hold some info text and simple, colored rectangles. The title screen is just that with two extra buttons to start a game or to leave it completely. And the game layer will hold the main game objects, such as the balls, the enemies, and the tiles. Also, the particle effects will use the game layer. Just as a little reminder, with layers you can group sprites to handle them in one batch. Layers also control the order in which sprites are drawn.

The title screen

In this game, we will keep it simple. No bitmap image graphic was harmed for Balls Out!, this time. No starving artist had to do unpaid overtime to create the title screen. We will use just a two-colored rectangle and then some text on the screen, for the title. For the buttons, we will use text objects and set them to be touchable. The fantomEngine framework makes it easy to use regular images as GUI objects.

Game background

Again, for the game background, we will also make use of two colored rectangles drawn on top of each other. Also there is a button drawn on it, which lets the user go back to the title screen. And of course, in the header area, you will find two text objects for the game score, and the current Frames Per Second (FPS) value is displayed. The FPS is important to know you code for a mobile device. They are simply not as powerful as a desktop.

The ball

The ball is the object that we want to control in the game. We have to make sure that we navigate it into the tiles and avoid the enemies that roam around the game field.

Enemies

To separate the game a little from its classic ancestors, we will add enemies that roam around the game field on precalculated paths. Each time you have removed all the ball tiles, another enemy will appear and will make your life even harder.

The ball tiles

These have to be hit by your ball. Once that happens, they will disappear and a nice sound will be played. Also, we will play some little particle effects for eye candy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset