Game Development Reference
In-Depth Information
Next to the actual tiles, you also store a hint together with the level definition. Here you can see the
instruction that stores the first level in the LEVELS global variable:
window.LEVELS.push({
hint : "Pick up all the water drops and reach the exit in time.",
locked : false,
solved : false,
tiles : ["....................",
".................X..",
"..........##########",
"....................",
"WWW....WWWW.........",
"---....####.........",
"....................",
"WWW.................",
"###.........WWWWW...",
"............#####...",
"....WWW.............",
"....###.............",
"....................",
".1........W.W.W.W.W.",
"####################"]
});
This level definition defines a number of different tiles and objects. For example, a wall tile is defined
by the # sign, a water drop by a W character, and the start position of the player by the 1 character.
If there is no tile at the specific position, you use the . character. For the platform game, you
need different types of tiles: a wall tile the player can stand on or collide with, and a background/
transparent tile that indicates there is no block in that position. You also want to define a platform tile .
This tile has the property that the player can stand on it like a wall tile, but if they're standing under it,
they can jump through it from below. This kind of tile is used in many classic platform games, and it
would be a pity not to include it here! In the level data variable, platform tiles are represented by
a - character. Table 24-1 gives a complete list of the different tiles in the Tick Tick game.
Search WWH ::




Custom Search