In the first part of this video series on how to create a shooter style video game in Adobe Flash, we created our main characters, made them move, and shoot. In the second part, we animated our characters. In the third part, we animated our background. In this fourth part of the video tutorial series, we'll add our lives, score, and Game Over.
The code for our lives, score, and Game Over is already embedded in our file. We added all of this code in the first step. Now we just need to add our score, lives and Game Over and link them to them code.
Step 1 - Add the Score
Use the text tool, find a place that you want the word "Score" to appear on your stage and type "Score". In the properties panel for this text, be sure that it is static text. Now beside the word "Score", pull out a new text box, again with the text tool. This time be sure that the text is dynamic. You can change it from static to dynamic in the properties panel of the text. Then, in the properties panel, under "options", type the following in the "variable" box...
Now your score will work adding "10" points for every enemy hit.
Step 2 - Add the Lives
Now you'll follow similar steps for the lives. Find a place on your stage for the word "Lives". Using the text tool, add static text to read "Lives". Beside the word "Lives", add a new dynamic text box. In the properties panel for this text, under "options", type the following text in the "variable" box...
Now your lives work. You will start with "3" lives. If you play your game at this point, you keep losing lives into negative values. To fix this we need to add our "Game Over" movie clip.
Step 3 - Create a "Game Over" Movie Clip
Now we need to add a "Game Over" sequence to our game. Go to the library, and create a new movie clip. Name this new movie clip "GameOver". Select the "export for actionscript" radio button when you create the new symbol. Then, in the new timeline, draw what you want your "Game Over" sequence to look like.