Game Development Reference
In-Depth Information
Defining the game levels
Like the game levels in No Tanks (Chapters 6 and 7), we will use Mappy to create our levels. See
Chapter 6 for a full set of information on using Mappy. You don't have to use Mappy or any other
tool we suggest to create your levels; they can be designed by hand or with any tools you desire.
Unlike in Chapter 6 and 7, we will not be creating two layers for our world. There is only one
sprite in our game, the player's car. Everything else, even the pick-up objects, is part of the game
background. This allows us to easily scroll the screen with blitting and not have to keep track of a
series of offsets for all of the game objects.
In our rules for level design, each level must contain the following
50 rows and 50 columns of 32
32 tiles
A wall around the entire outside of each level (no warping as in NoTanks!)
One and only one of the first three car sprites
At least one heart sprite
At least one of the yellow-line goal sprites
Make sure that the all black road tiles are tile 22 (the black square), not tile 0 from the Mappy tile
library. It is very important that no tiles are left the Mappy default blank tile.
Obtaining the level data
Like the level data in No Tanks!, our levels will be stored in a 2D array by using the Export For
ActionScript option in the Custom menu. The data for each tile row must be structured like the
following code snippet. The 6 is the tile number. Tile row happens to be the top of the world, so
the entire row id tile 6 .
map = [
[6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6]
[6,13,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,14,
6,6,6,6,6,6,6,6,6,13,21,21,21,21,21,21,21,21,14,6,6,6],
[6,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,3,21,21,21,21,21,21,21,21,21,21,21,14,
6,6,6,6,6,6,6,13,21,21,21,21,21,21,21,21,3,21,14,6,6],
[6,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,3,21,21,21,
21,14,6,6,6,6,6,13,21,21,21,21,21,21,21,21,21,21,21,21,14,6],
[6,11,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,
21,21,21,14,6,6,6,13,21,21,21,3,21,21,21,21,21,21,21,21,21,21,6],
[6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,11,21,21,21,21,21,21,21,21,21,14,6,13,
21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,6],,
...];
The level we will create is much too large to show on a single screen, so Figure 10-5 shows a
miniature consolidation image of the entire level 1.
Search WWH ::




Custom Search