Creating a Flash Lite Game - Page 5
Pages 1, 2, 3, 4, 5The player will be directed to the Game Over Frame if he loses all his lives. The Game Over screen will display the final score achieved and will give the player the option to play the game once more. This means that we will have to put some static text, dynamic text to display the score, and a button to make key commands to restart the game. We will do these from the bottom up.
Adding Text
Select the Main Content layer and use the Text Tool to write YOUR SCORE IS at the upper part of the stage and then write PLAY AGAIN? at the lower section of the stage as illustrated in the image below. You will have to make sure that the type of both of these texts is static (check the Properties Inspector).

Displaying the Score
To display the actual score on the screen, we need to use a Dynamic Text Field. Make sure that nothing on stage is selected, select the Text Tool, and then access the Properties Inspector and assign the Text Type to Dynamic Text to be able to draw such a text field. Now draw a big rectangular field between the two lines of text you have on stage. While your text field is still selected, set the size to 80px, the font to _sans, center the text, and then assign the variable name score to it.

Adding Key Controls
To register the key command for the game to be played again would require us to create a button the same way we did for the previous commands. Select the Buttons layer, open up the Library (Ctrl+L) and drag a copy of the myButton symbol we created previously. Put it somewhere above the stage. Now right-click this button and select Actions to open up the Actions panel. Type this code to make the game play once again when pressing the Enter button. The code is self-explanatory. Frame 2 is the Intialization Frame which sets all the variables and objects required to start the game, the game will follow from there automatically.
gotoAndPlay(2);
}
We are done! In this final stage you did the following:
- Added the Game Over text to the Main Content layer.
- Added the Score display text field to the Main Content layer.
- Added a button to the Buttons layer and configured the key controls to go back and play the game.
We are done. You can now test your movie or export it to try it on your mobile device.

The game we created here is a very basic one, I added a couple more features to make this game richer, you can download it to get an idea on how you expand your game.
I hope you found this tutorial helpful. Feel free to post the Oman3D Forum if you have any questions.
- End of Tutorial.
