Game Development Reference
In-Depth Information
instructionsScreen = new BasicScreen(FrameWorkStates.
STATE_SYSTEM_INSTRUCTIONS,400,400, false,0x0000dd);
instructionsScreen.createOkButton("Play", new Point
(150, 250), 80, 20, screenButtonFormat, 0x000000,
0xff0000,2);
instructionsScreen.createDisplayText(
"Click the blue\ncircles",150, new Point(120,150),
screenTextFormat);
gameOverScreen = new BasicScreen (FrameWorkStates.
STATE_SYSTEM_GAME_OVER,400,400,false,0x0000dd);
gameOverScreen.createOkButton("OK", new Point(170, 250),
40, 20,screenButtonFormat, 0x000000, 0xff0000,2);
gameOverScreen.createDisplayText("Game Over",100,new
Point(140,150),screenTextFormat);
levelInScreen = new BasicScreen(FrameWorkStates.
STATE_SYSTEM_LEVEL_IN, 400, 400, true, 0xaaff0000);
levelInText = "Level ";
levelInScreen.createDisplayText(levelInText,100,new
Point(150,150),screenTextFormat);
//set initial game state
switchSystemState(FrameWorkStates.STATE_SYSTEM_TITLE);
waitTime= 40;
//create timer and run it one time
frameRate = 30;
startTimer();
}
}
}
In Chapter 2, we discussed in detail each of these changes to the Main.as init function necessary
to customize it for the stub game. There is very little new introduced in this version of Main for
Super Click, but in case you need a refresher read through the next section. If not, you can skip
to “The Game class for Super Click” section.
Importing classes and defining variables for Main.as
Along with the Flash library classes we need for text and formatting, we also import in the Point
class, so we can pass Point instances that contain the location values for the BasicScreen and
SimpleBlitButton instances we will instantiate in the init function. The only variables we need
to define are the constants for the ScoreBoard . We have four elements on the ScoreBoard for our
stub game, so we have created a constant name for each.
Search WWH ::




Custom Search