Game Development Reference
In-Depth Information
private var pickupHitPoint:Point = new Point(0, 0);
//temps for loops
private var tempExplode:BlitSprite;
private var tempPickup:BlitSprite;
//explosions
private var explosionList:Array;
//pickups
private var ammoPickupList:Array;
private var lifePickupList:Array;
private var ammoPickupAmount:int;
//missiles
private var playerMissileList:Array;
private var tempMissile:BlitSprite;
private var enemyMissileList:Array;
//** end the final Game.as variables **
Adding the new NoTanks.as init function
The new init function is going to delete the newGame function call and set the focusRect to be false .
private function init():void {
this.focusRect = false;
initTileSheetData();
}
The newGame function is now called by Main.as and the focusRect will be set to false when the
level starts.
Creating the newGame function
This function is almost a complete rewrite of the original newGame function. We have added code
to reset the level , score , lives , and gameOver variables, as well as dispatch events to update the
four scoreboard elements.
override public function newGame():void {
setRegions();
level = 0;
score = 0;
lives = playerStartLives;
gameOver = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownListener);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
addChild(canvasBitmap);
dispatchEvent(new CustomEventScoreBoardUpdate(CustomEventScoreBoardUpdate.
UPDATE_TEXT,Main.SCORE_BOARD_SCORE,"0"));
Search WWH ::




Custom Search