Game Development Reference
In-Depth Information
The Engine Classes
In this section, I will outline each of the classes involved in the
core engine of this platformer and walk through the code of each.
This is where the bulk of the code for this game resides, and it
important to understand all the components at play.
￿ This is the big one; all the core functionality
as support for the engine.
￿ To efficiently store information about the game
grid, we will use this custom data structure, which relies on
multidimensional arrays and vectors to keep track of everything
going on in the game.
￿ Each grid square has an accompanying
GridReference object, which stores which enemies, items, walls,
and portals are in a given slot on the grid.
￿ This is a data class that allows for easy
configuration of different aspects of the engine, and makes it
easier to change the behavior of the engine properties from
level to level by storing preconfigured instances of this class.
￿ Each portal instance has an array of these
objects, which define what requirements must be met in order
to finish a level.
￿ An enumeration class, this file simply
contains preapproved destinations for portals (which map to those
mentioned earlier in the XML) and makes it easy to add new ones.
￿ Tucked inside the events subpackage, this
class extends a normal DataEvent that the PlatformerEngine can
dispatch when certain things happen inside the game; it also
stores enumerations for all the different game events.
This set of interfaces in the Sprites subpackage all define the
necessary methods required for Sprites, which wish to act as the
player, enemies, and so on in the game.
ll work through these classes in reverse order, so that the
main engine class will make more sense in context.
The ISprite Interface
This interface is the foundation for all of the other types of Sprites,
except walls. It extends IEventDispatcher, so that if, at some point,
we need the Sprites to be able to easily dispatch events, there will
be no interface conflicts.
package com.flashgamebook.engines.platformer.sprites {
import flash.display.Sprite;
import flash.display.DisplayObject;
Search Nedrilad ::

Custom Search