Game Development Reference
used to enter portals. The player
s jump height is equal to 1.5 times
the height of a grid square. This allows for the player to clear gaps
one grid space in width and to easily jump onto grid squares one unit
above. Additionally, the player has the ability to carry items in an
inventory. In our iteration, these items will primarily consist of treas-
ure and keys for unlocking doors, but could include other pickups like
health in the future.
Both keys for unlocking portals and treasure are classified as items .
They share a similar relationship in that they both disappear and
are added to the player
s inventory when the player moves over
them. The game will define certain special types of items (such as
keys), which will be used by the game engine in a particular way.
Items not predefined by the enginewillsimplyaccumulateinthe
inventory, and it will be up to the particular implementation of the
game as to how to handle them when they are picked up.
An enemy in this game will be defined as any entity that is toxic to
the player. Coming into contact with an enemy will damage the
player, either by taking a life or eating away at the player
inanimate object or a moving creature with basic AI. As such, ene-
mies can either process physics such as gravity or choose to ignore
them (imagine stalactites in a cave).
In Fig. 14.2 ,you
ll see a level design for the platformer based
around a 10
10 grid. As the key below shows, black squares repre-
sent walls and white squares are movable areas for the player. The
dollar signs are treasure that can be picked up for points, and the key
icon represents the key required to exit through the portal at the top
of the level. There is also one enemy along the bottom of the level
that will move back and forth. The player must jump over the enemy
to avoid it. The player will start the level at the top, in the one notch
cut out of the border wall surrounding the level. All of the levels for
the game can (and probably should) be mapped out this way. This
type of system is also very handy because it can translate into a stan-
dardized format like XML (which we will look at momentarily), and it
is relatively straightforward to create an editor app for building levels.
The Level File Format and Asset Structure
It is a good idea to keep all of the data for each level in external
files. This allows you to load new levels at runtime, as well as cre-
ate your own in a standardized format, either by hand or