Game Development Reference
In-Depth Information
private function playerDied(e:PlatformerEvent) {
trace( " GAME OVER: Player killed by " ,;
gameOverText.visible = true;
private function inventoryUpdate(e:Platformer
Event) {
_score = _previousScore + _platformer.
pointsText.text = _score.toString();
The primary method behind this class is nextLevel . It creates the
objects necessary to instantiate the game engine and start the load-
ing process. If you test this SWF using the bandwidth profiler inside
of Flash, you
ll see that it accurately moves from 0 to 100% over the
course of loading all the assets. The method also sets up listeners
for the major game events, like the player dying, picking up items,
and going through the end portal. Overall, this class is pretty bare
this is only slightly more than the bare minimum code
required to get an instance of the PlatformerEngine up and run-
ning. Next, we
ll look at the different asset classes, and how each
one is tied to specific game assets.
The Asset Classes
The PlatformerEngine only makes use of interfaces to manipulate
the Sprites used in the game. In order for us to build assets for the
each type of object. If you look in the example package, you
notice that each of the classes besides the main document file map
to one of the five types of interfaces in the engine: player, enemy,
item, wall, and portal. Let
s examine how each of these classes
implements the appropriate interface. Because we
re going for a
minimalist implementation here, these classes are pretty simple and
only include the bare essentials to meet the requirements of the
The Player Class
This class will be used to implement the IPlayer interface.
Search Nedrilad ::

Custom Search