Game Development Reference
In-Depth Information
Creating the instructions screen
The instructionsScreen is instantiated exactly like the titleScreen only with parameter values
passed in specific to the instructions. Some of the differences you will notice are the use of the
FrameWorkStates.STATE_SYSTEM_INSTRUCTIONS for the id value of the BasicScreen instance, the
new text for the button Play, and the new text for the screen, "Click the blue\nCircles" . You will
also notice that some sizes and locations have been customized for these new text values.
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);
Creating the game over screen
The gameOverScreen is instantiated exactly like the instructionsScreen only with parameter
values passed in specific to the game over state. Some of the differences you will notice are the
use of the FrameWorkStates.STATE_SYSTEM_GAME_OVER for the id value of the BasicScreen
instance, the new text for the button "OK" , and the new text for the screen, GAME OVER. You will
also notice that some sizes and locations have been customized for these new text values.
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);
Creating the Level In screen
The levelInScreen is different than the other three screens, because it doesn't make use of
BasicScreen classes' okButton . It does make use of a custom Main.as variable called
levelInText .. This variable will hold the default prefix that will be added to the levelInScreen
object's text box on each new level.
levelInScreen = new BasicScreen(FrameWorkStates.
STATE_SYSTEM_LEVEL_IN, 400, 400, true, 0xaaff0000);
levelInText = "Level ";
levelInScreen.createDisplayText(levelInText,100,new Point(150,150),screenTextFormat);
//Set standard wait time between levels
waitTime= 30;
We also set the waitTime variable to be 30 frames (or the equivalent of 1 second if our frame rate
is set to 30). This variable will be used by the STATE_SYSTEM_WAIT as the default wait time. The
levelInScreen uses this state for a transition time delay before the game level starts.
Search WWH ::




Custom Search