Game Development Reference
In-Depth Information
public static const SCORE_BOARD_SCORE:String = "score";
public static var SOUND_TITLE_MUSIC:String = "titlemusic";
public static var SOUND_IN_GAME_MUSIC:String = "ingamemusic";
public static var SOUND_EXPLODE:String = "explode";
public function Main() {
if (stage)
addedToStage();
else
addEventListener(Event.ADDED_TO_STAGE, addedToStage,false,0,true);
}
override public function addedToStage(e:Event = null):void {
if (e != null) {
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
super.addedToStage();
trace("in tunnel panic added to stage");
init();
}
override public function init():void {
trace("init");
game= new TunnelPanic();
setApplicationBackGround(600, 400, false, 0x000000);
//add score board to the screen as the seconf layer
scoreBoard = new ScoreBoard();
addChild(scoreBoard);
scoreBoardTextFormat = new TextFormat("_sans", "11", "0xffffff", "true");
scoreBoard.createTextElement(SCORE_BOARD_SCORE, new
SideBySideScoreElement(200, 0, 20, "Score",
scoreBoardTextFormat, 25, "0", scoreBoardTextFormat));
screenTextFormat = new TextFormat("_sans", "16", "0xffffff", "false");
screenTextFormat.align = flash.text.TextFormatAlign.CENTER;
screenButtonFormat = new TextFormat("_sans", "12", "0x000000", "false");
titleScreen = new BasicScreen(FrameWorkStates.STATE_SYSTEM_TITLE,
600,400,false,0x000000 );
titleScreen.createOkButton("Play", new Point(250, 250), 100, 20,
screenButtonFormat, 0x000000, 0xff0000,2);
titleScreen.createDisplayText("Tunnel Panic", 200, new Point(200, 150),
screenTextFormat);
instructionsScreen = new BasicScreen(FrameWorkStates.STATE_SYSTEM_INSTRUCTIONS,
600,400,false,0x000000);
instructionsScreen.createOkButton("Start", new Point(250, 250),
100, 20,screenButtonFormat, 0x000000, 0xff0000,2);
instructionsScreen.createDisplayText("Dodge everything\nCan you go far?.",300,
new Point(150,150),screenTextFormat);
gameOverScreen = new BasicScreen(FrameWorkStates.STATE_SYSTEM_GAME_OVER,
600,400,false,0x0000dd);
Search WWH ::




Custom Search