Game Development Reference
In-Depth Information
bg = new BackImage();
addChild(bg);
scoreLabel.text = "Score:";
levelLabel.text = "Level:";
chancesLabel.text ="Misses:"
scoreText.text ="0";
levelText.text ="1";
chancesText.text ="0";
scoreLabel.y = SCOREBOARD_Y;
levelLabel.y = SCOREBOARD_Y;
chancesLabel.y = SCOREBOARD_Y;
scoreText.y = SCOREBOARD_Y;
levelText.y = SCOREBOARD_Y;
chancesText.y = SCOREBOARD_Y;
scoreLabel.x = 5;
scoreText.x = 50;
chancesLabel.x = 105;
chancesText.x = 155;
levelLabel.x = 205;
levelText.x = 260;
addChild(scoreLabel);
addChild(levelLabel);
addChild(chancesLabel);
addChild(scoreText);
addChild(levelText);
addChild(chancesText);
gameState = STATE_INIT;
}
public function gameLoop(e:Event):void {
switch(gameState) {
case STATE_INIT :
initGame();
break;
case STATE_PLAY:
playGame();
break;
case STATE_END_GAME:
endGame();
break;
}
}
public function initGame():void {
score = 0;
chances = 0;
player = new PlayerImage();
enemies = new Array();
Search WWH ::




Custom Search