![]() |
Page 11 of 15
More Fruit
Let us now add some variation to the game by including other types of fruit. Because the steps are
the same as before we only describe the global details. The sprites for the fruits are
already there so we don't need to add them anymore.
Add a new object (click the blue ball). Give it an appropriate name and give it the banana sprite. This
one is going to be a bit more difficult to click on. Add the Create event and in it add the action to
move in a fixed direction. Only select the diagonal arrows and give it a speed of 12.
Add a Collision event with the wall object and it in add the action to bounce, just as before. Next add the
Mouse event for Left pressed. In it add the action to let the object jump to a random position.
Add the action to set the score (from the score tab) with a value of 100 (this is a more difficult fruit
so you should get a higher score), and don't forget to click the Relative box to add the value to the score.
Finally add the action to play a sound (from the main1 tab) and play the click sound.
In the same way add an object for the cherry and for the strawberry. You can give them different speeds and corresponding
higher or lower scores. If you find this all a lot of work, you can also right-click on an existing object and select
Duplicate. This creates a copy of the object. You can now change the name and sprite, and
change the values for the different actions (by double clicking on them).
![]()
Now reopen the room (double click on it in the list) and add a few instances of the different fruits. You might need to remove some apples to
make room. Remember that you can use the right mouse button to remove instances.
Save and play the game. Test it all carefully.
Make sure that you indeed get a score that corresponds with the difficulty of the fruit.
|