Chocobreak Tutorial - Step 12
Step 12: A Hi-Score table
One final thing to do to put some finishing touches on our game : detect when the number of lives equals zero, and when it is, end the game. This can be done very simply : click on New condition and in the New condition dialog, right click on the Player 1 object. Choose the option "Compare to player's number of lives".
This opens the expression editor : just click on OK, we want to compare to zero.
You certainly understand that when the number of lives reaches zero, Clickteam Fusion 2.5 will switch automatically to the next frame. Next frame? But there is no next frame yet! Well, we are going to create a new frame with a high score table.
A New Frame
To do so, we need to display the Storyboard editor. You remember, the very first editor that we encountered? Well this is it. Click on the Storyboard Editor icon in the tool bar.
The storyboard editor is the place where you can have a global view on your application : it shows all the frames one after the other. For the moment we only have one frame. We are going to add a new frame. Click on the "2" button:
First of all, we are going to drop a background object with a nice picture. Locate the object ScreenHighScore in the library window and drag & drop it onto the frame. Position it properly so that it covers the entire white, play area.
Now for the Hi-Score object. Select the option "Insert" / "New object" in the main menu, and choose the Hi-score object. Drop it in the middle of the frame. In the property toolbar, you can now see all the properties of the object. Feel free to experiment. Do not forget to change the font of the object by clicking on the "Text Options" tab in the property toolbar. Personally I chose a Arial Bold font, size 20.
We now have to program the events of our little high-score frame. Click on the Event editor button in the tool bar. As you can see, the list of events is empty. What we want to do is simple : display the high-score table for 10 seconds, and then, restart the game.
You might guess that we are going to use the Timer object to do this. Click on New condition and in the New condition dialog box, right click on the Timer object. Choose the option "Is the timer equal to a certain value".
And in the following dialog, enter 10 seconds (you can drag the bar or type the number in).
Now for the action. Move your mouse under the Storyboard Controls object, and click with the right mouse button. In the actions menu choose the option "Restart the application".
You can now play your game from the start. To do so, do not click on the Run Frame icon as you are used to do, but click on the Run Application icon.
Spread the word!
You can share this document using the following buttons.