Chapter 2. Game Concept and Assets

This chapter will introduce the game that we are going to make throughout the course of this book. Even though this is not strictly an AndEngine topic, every game must begin with a concept. We will outline the basic entities and gameplay rules. We will also prepare all the assets needed for the game: graphics, sounds, and music. This chapter will give you an idea of where to get pre-made assets. In the second part of the chapter, we are going to include the assets to our game.

The game concept will be a Doodle Jump type of game that illustrates many of the AndEngine features. We are going to create something that is called a game clone. We will use similar rules but our own assets and code. Game clones are often the first witnesses of a new game genre being born.

The game concept

We need to know how our game is going to look before we start coding. It is important to have a basic idea and try to imagine whether this idea will work. For your first game, it's highly recommended to start with something small and possibly something that already exists.

Tip

Do not start with a complex idea. If it is your first game, you will most likely get stuck and have a hard time finishing it. Pick something you can finish in a matter of days.

Start with a pen and paper or some simple graphics software and try to draw the basic screen from the game. The following figure is an example:

The game concept

The basic idea is very simple. However, let's try to state even the obvious details. This helps us to make sure we don't forget anything. The main goal of the character is to get as high as possible. The score will be calculated from the height reached. The obvious facts are that the game will be played in portrait mode and that there is gravity that pulls our character down. The not so obvious fact is that when the character leaves the screen from the left or right side, we want him to come back on the other side. This is called wrap around.

There are randomly generated platforms that he can use as spring boards. The character will be able to pass through the platform upwards, then fall on it, and the platform should propel him up again. This is the key element of the game. See the following illustration:

The game concept

As the character moves upwards, the camera follows him. When the character misses the last platform on the current screen, the game is over. This also means that we have to remove every platform that goes out of view when the view scrolls upwards.

To make the game a little bit more interesting, we can add enemies as well. These will be flies hovering in the air.

Finally, we are going to add some decorations, let's say a couple of clouds.

We are going to include the Box2D physics extension that will take care of gravity and collisions. We can implement these ourselves. This extension is probably overkill for such a simple game. Let's use it anyway to see how physics in games work.

We want to have a sound on each jump and also a sound that will be played when the characters misses the platform and falls down. We also want some background music as well.

Now, let's think about controls. The jump will be triggered automatically as soon as the character touches the platform. How should he move from left to right? There are basically two options. First, we can use touch controls. Either add two buttons to the screen or let the whole left half of the screen be a button to move left and the right half a button to move right. We can also make use of the accelerometer and let the character move by tilting the phone. Both approaches will work. Let's leave this question open for now. AndEngine makes both options very easy to implement.

Identifying the basic entities

Let's review the concept and identify the basic entities in the game. They are as follows:

  • Character
  • Platform
  • Enemy
  • Cloud

That's it. For each of the entities, we will need a graphic representation. The character and enemy will be animated. For platforms and clouds, we only want static images.

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

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