HTML and CSS Reference
In-Depth Information
The tower Defence gameplay is very simple and straightforward. The sample game will only require three scenes:
main menu, game play, and game over. The main menu scene and game over scene are quite simple, while the game
play scene has many layers to contain different elements, as shown in Figure 24-12 .
Game
MainMenu Scene
GamePlay Scene
GameOver Scene
MainMenu Layer
Game Layer
GameOver Layer
Map
Layer
Tower
Layer
Bullet
Layer
ToolBar
Layer
Monster
Layer
Figure 24-12. The scenes and layers of the tower defence project
The Tower Defence Gameplay Scene
The game play scene contains a game layer and five sublayers: the Map layer, Tower layer, Monster layer, Bullet layer,
and Toolbar layer. All of the layers will be introduced later.
The game play scene contains most of game logic in the game. There is a predefined path where all enemies walk.
There are two gun towers on the path to defeat the enemies. The attack range of the tower is limited to a circle, and
you can adjust the position of towers. There are two types of towers and three types of enemies. If your score is greater
than 2,000, you win. You lose if one monster passes through the gate.
The key to winning is to reposition the towers in the right place or add the right monsters in the menu to help you
to get a high score quickly.
Designing the Required Game Components
In order to make the tower defence game, you'll design the following components:
1.
A main menu for the game, a game play scene, and a game over scene.
2.
The map has a predefined path. The path can be modified easily. In your game sample,
you will use tiled maps to edit the path.
3.
There are two types of towers. The towers are gun towers and support repositioning. You
must implement drag-and-drop functionality for the towers, and it should be easy to
modify their properties.
4.
There are different types of enemies with various running speeds and hit points. You'll use
the CardinalSplineTo action to make the enemies follow the path.
5.
There is collision detection mechanism between the enemy and bullets fired from the
tower. In this example, you'll use QuadTree to implement collision detection. QuadTree is
a tree data structure in which each internal node has exactly four children.
6.
Setting up the conditions for winning or losing a game.
 
 
Search WWH ::




Custom Search