In this tutorial you will be making the asteroids dangerous from the previous lesson and keep score! After firing a projectile at an asteroid your score will increase and if an asteroid hits you first it will take a "life" away!
Click in the window above (so the game has focus instead of the surrounding web page) and then use the arrow keys to follow the asteroids and press the spacebar to fire, watching your score and lives change!
1) Start Multimedia Fusion and close the "Tip of the day" box.
2) If you don't see the MMF libraries window click VIEW - Multimedia Fusion Libraries
3) File - Open your previous lesson file
Open the Frame Editor and Insert - Insert an Object
Pick the Lives object and click on the area of the stage you wish the graphic to appear.
An options edit box will pop up. The default is 3 Lives and a graphical display. Choose OK. If the graphic isn't exactly where you want it you can drag it with the mouse elsewhere.
Again, open the Frame Editor and Insert - Insert an Object
This time pick the Counter object and click on the area of the stage you wish the score counter to appear.
The default options for the counter edit box is Numbers display
and the color of the numbers will be black.
OPTIONAL:
To change the color of the score font click on the Edit button...
Select all the numbers....
On the far left vertical task bar the font icon will become clickable. Click on it and the standard Windows font selection option box will
open.
Your game layout should now look similar to this.
Go into the Event Editor and down to the event "Collision between [bullet] and [asteroid]" (from the previous lesson). Right click in the score Counter column and select Add to Counter. The expression editor will open allowing you to enter a number value. Enter 25 and OK. Now, when your projectile hits an asteroid you will receive 25 points to your score!
To make things fair you should probably lose a "life" when an asteroid hits you first. Go down to the event "Collision between [saucer] and [asteroid]" (from the previous lesson). Right click in the Player 1 column and select Number of Lives - Subtract from Number of Lives. The expression editor will open allowing you to enter a number value. Enter 1 and OK. Now, when an asteroid hits you, you will lose a life!
Now, to finish things off we need to check the number of lives during the game so that when lives are zero your saucer ship is destroyed. In the event editor right click New Condition, right click the Player 1 icon and select "Compare to player's number of lives".
In the new "Number of lives = 0" event row right click in the saucer column and choose Destroy.
Now when you press the play icon you will see that you have a full fledged mini-game!
More than likely you'll want to add sound and use your own graphics for your game. That will be covered in the next lesson! Tips:
As your game becomes more complex in the event editor you can view just the codes specific to one object by clicking the object icons at the top of the event editor. Challenges:
Could you make a button that says START to restart after you win or lose?
Could you make new WIN and LOSE slides to jump to when your lives are zero or your score is max?