Game Development Reference
In-Depth Information
The PortalDestinations and PortalRequirement
Classes
Because they
'
re both very short, we
'
ll now look at the two classes
related to portal behavior.
package com.flashgamebook.engines.platformer {
public class PortalDestinations {
public static const NEXT_LEVEL:String = " nextLevel " ;
public static const PREV_LEVEL:String = " prevLevel " ;
}
}
While these two enumerations could have potentially been tucked
away into the PlatformerEngine class, it makes more sense for them to
be singled out. This is because there may be more functionality to add
to portal behavior, such as the ability to move between two different
portals on in a single map. This framework allows for that extensibility.
package com.flashgamebook.engines.platformer {
public class PortalRequirement {
public static const INVENTORY:String = " inventory " ;
public static const ENEMY_KILLED:String =
" enemyKilled " ;
public var type:String;
public var name:String;
public function PortalRequirement(type:String,
name:String) {
this.type = type;
this.name = name;
}
}
}
PortalRequirement objects are also very simple and could have had
their limited functionality handled by a generic object, but it
'
sabetter
practice to statically type it and create a space for future functionality.
The PlatformerConfig Class
This class exposes certain properties of the engine by allowing you
to preconfigure the behavior of the engine before even creating it.
Search Nedrilad ::




Custom Search