Game Development Reference
In-Depth Information
// init() is used to set up all of the things that we should only
need to do one time
override public function init():void {
game = new DiceBattle(600,400);
setApplicationBackGround(600,400,false, 0x000000);
//add application background to the screen as the bottom layer
//add score board to the screen as the seconf layer
scoreBoard = new ScoreBoard();
addChild(scoreBoard);
var scoreBoardTextFormat1:TextFormat = new TextFormat("_sans", "11", "0xffffff", "true");
var scoreBoardTextFormat2:TextFormat = new TextFormat("_sans", "11", "0xff0000", "true");
var scoreBoardTextFormat3:TextFormat = new TextFormat("_sans", "14", "0xffffff", "true");
var scoreBoardTextFormat4:TextFormat = new TextFormat("_sans", "14", "0xff0000", "true");
var scoreBoardTextFormat5:TextFormat = new TextFormat("_sans", "10", "0xffffff", "true");
var scoreBoardTextFormat6:TextFormat = new TextFormat("_sans", "25", "0x00ff00", "true");
var scoreBoardTextFormat7:TextFormat = new TextFormat("_sans", "25", "0xff0000", "true");
scoreBoard.createTextElement(SCORE_BOARD_SCORE,
new SideBySideScoreElement(75, 5, 15, "Score:",
scoreBoardTextFormat1, 25, "0", scoreBoardTextFormat2));
scoreBoard.createTextElement(SCORE_BOARD_LEVEL,
new SideBySideScoreElement(325, 5, 10, "Level:",
scoreBoardTextFormat1, 50, "0",scoreBoardTextFormat2));
scoreBoard.createTextElement(SCORE_BOARD_TURN,
new SideBySideScoreElement(250, 380, 10, "Turn:",
scoreBoardTextFormat3, 50, "0", scoreBoardTextFormat4));
scoreBoard.createTextElement(SCORE_BOARD_PLAYER_LIFE,
new SideBySideScoreElement(25, 150, 10, "Life:",
scoreBoardTextFormat5, 20, "0",scoreBoardTextFormat6));
scoreBoard.createTextElement(SCORE_BOARD_COMPUTER_LIFE,
new SideBySideScoreElement(480, 150, 10, "Life:",
scoreBoardTextFormat5, 20, "0", scoreBoardTextFormat7));
//screen text initializations
screenTextFormat = new TextFormat("_sans", "14", "0xffffff", "true");
screenButtonFormat = new TextFormat("_sans", "11", "0x000000", "true");
titleScreen = new BasicScreen(FrameWorkStates.STATE_SYSTEM_TITLE,
600,400, false, 0x000000);
titleScreen.createDisplayText("Dice Battle! ", 120,new Point(255,
150),screenTextFormat);
titleScreen.createOkButton("Go!",new Point(250,250),100,20,
screenButtonFormat,0xFFFFFF,0x00FF0000,2);
instructionsScreen = new BasicScreen(
FrameWorkStates.STATE_SYSTEM_INSTRUCTIONS, 600,400, false, 0x000000);
instructionsScreen.createDisplayText("Beat The Computer!",
250,new Point(230, 150),screenTextFormat);
Search WWH ::




Custom Search