官术网_书友最值得收藏!

  • Learning AndEngine
  • Martin Varga
  • 584字
  • 2021-04-02 10:02:03

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.

主站蜘蛛池模板: 库尔勒市| 通城县| 桃园县| 界首市| 蒲江县| 雷山县| 固始县| 清丰县| 武夷山市| 房产| 轮台县| 渑池县| 亚东县| 罗江县| 东乌珠穆沁旗| 昔阳县| 池州市| 德格县| 余姚市| 乌兰县| 图片| 衢州市| 布拖县| 定边县| 永吉县| 桓台县| 麻城市| 剑川县| 山西省| 龙岩市| 信宜市| 柳林县| 佳木斯市| 松原市| 涞水县| 彰武县| 霍城县| 轮台县| 榕江县| 永泰县| 安福县|