Game Development Reference
In-Depth Information
￿
AirHockeyEngineConfig.as :Thisissimplyabasicstructure,
consisting of parameters you need to define for the engine to
work. This is more practical than setting values directly on the
engine itself or passing in a horde of parameters to an
initialization function. Doing it in this way also lends itself
better to validation, like we performed on levels in Marble
Runner; however, I don
'
t implement any validation here.
￿
Main.as : The document class for the whole application. There
will be very little here, which is new from previous examples.
￿
Title.as :Theclasswrapperforthetitlescreen
as basic as it
gets.
￿
Rules.as : The class wrapper for the rules screen, where I
'
ll
briefly demonstrate gesture events.
￿
Game.as : The heart of the application, which creates and
controls the state machine, routes input information, and
instantiates the engine.
￿
GameTouchController.as : The wrapper for touch input in the
game since we need it to behave in a specific way to avoid
twitchiness or hiccups.
We
ll start with the relatively superficial bits of application func-
tionality and then move to the game itself.
'
Main.as
As with other examples, the main document class just handles
navigation between sections of the game, which number three in
this application.
public class Main extends MovieClip
{
static public const FRAME_TITLE:String = " title " ;
static public const FRAME_RULES:String = " rules " ;
static public const FRAME_GAME:String = " game " ;
static private var mInstance:Main;
public function Main()
{
mInstance = this;
enumerateFrameLabels();
addEventListener( FRAME_TITLE, onFrameTitle,
false, 0, true);
addEventListener( FRAME_RULES, onFrameRules,
false, 0, true);
addEventListener( FRAME_GAME, onFrameGame, false,
0, true);
gotoAndStop(FRAME_TITLE);
}
Search Nedrilad ::




Custom Search