Game Development Reference
In-Depth Information
// it suspends the game and allows animation or other
//processing to finish
public var waitTime:int;
public var waitCount:int=0;
public function GameFrameWork() {
}
public function init():void {
//stub to override
}
public function setApplicationBackGround(width:Number,
height:Number,isTransparent:Boolean = false,
color:uint = 0x000000):void {
appBackBitmapData = new BitmapData(width, height,
isTransparent, color);
appBackBitmap = new Bitmap(appBackBitmapData);
addChild(appBackBitmap);
}
public function startTimer():void {
timerPeriod = 1000 / frameRate;
gameTimer=new Timer(timerPeriod);
gameTimer.addEventListener(TimerEvent.TIMER, runGame);
gameTimer.start();
}
public function runGame(e:TimerEvent):void {
systemFunction();
e.updateAfterEvent();
}
//switchSystem state is called only when the
//state is to be changed
//(not every frame like in some switch/case
//based simple state machines
public function switchSystemState(stateval:int):void {
lastSystemState = currentSystemState;
currentSystemState = stateval;
switch(stateval) {
case FrameWorkStates.STATE_SYSTEM_WAIT:
systemFunction = systemWait;
break;
case FrameWorkStates.STATE_SYSTEM_WAIT_FOR_CLOSE:
systemFunction = systemWaitForClose;
break;
Search WWH ::




Custom Search