Home
Fusion 2.5+
Firefly+
Tutorials+
Videos+
Guides & Tips+
Extensions+
Versions
Teaching


Collecting the fruits

Collecting the fruits


Until now, the fruit would pass right through our player. We need to add an event for each fruit that we want to collide with our player.

Make a new event and select the “Collision -> Another object” action as shown on the image.

 

 

Here you select the object you want to test if collides with the runner object.

 

Your new event should look like this one:

  • Collision between (Runner) and (Apple)

This event basically asks MMF2 “Have our runner just collided with an apple?”
When the answer for that question is “yes”, it is our job to tell MMF2 what we then want to happen. In our case we want the apple to destroy and we want to give the player some points.
So in our new event, in the cell below the apple, we right click and select the ‘Destroy action’.

 

To give some score points to the player, we right click below the ‘Player 1’ object and select the “Score -> Add to score” action.

 

You can decidehow many points you want to award the player for collecting the apple. In this tutorial I decided to give the player 5 points.

 

Just like before, continue these steps to add collision test events for the other fruits.

 

After the other fruits where added, this is what the Event List Editor looks like:

  • (Runner) leaves the play area on the left or right

(Runner) : Stop

  • Every 03"-00

: Create (Apple) at (0,0) from (Small UFO)

  • Every 05"-50

: Create (Banana) at (0,0) from (Small UFO)

  • Every 07"-67

: Create (Grapes) at (0,0) from (Small UFO)

  • Collision between (Runner) and (Apple)

(Apple) : Destroy

(Player 1) : Add 5 to Score

  • Collision between (Runner) and (Banana)

(Banana) : Destroy

(Player 1) : Add 7 to Score

  • Collision between (Runner) and (Grapes)

(Grapes) : Destroy

(Player 1) : Add 10 to Score

As you can see, I’ve made the banana and the grape fruit drop with bigger intervals so they don’t drop as often as the apple. I’ve also changed how many points the player will be awarded when they collide with the bananas and grapes.

Currently there is no way the player of our game can watch his/her score, so we head back to the Frame Editor and insert a Score object.

 

 

When you insert the new score object, it will display a small black ‘0’. If you want to make the font bigger and change its colour, select the score object and go to the font properties in the Properties sidebar. Here I’ve changed the visible font and style of the score.

 

There are still a few things left to do before we are completely finished with our small game. If the UFO drops the fruits too close to the borders of the screen, the fruits can fall out of the screen making them impossible to collect.

 

For each fruit object we have, we make an event similar to the event that prevents the ‘Runner’ object from leaving the frame:

  • (Apple) leaves the play area on the left or right
  • (Banana) leaves the play area on the left or right
  • (Grapes) leaves the play area on the left or right

In these events you add a ‘bounce’ action below at the correct fruits. This will make the fruits bounce back into the frame if they are about to leave it.




Spread the word!



You can share this document using the following buttons.




Submit your own User Tip