4 The Bouncy Mushroom
The bouncy mushroom will be a simple way to add more interest to our game. When the play lands on or touches the mushroom, the character will be thrown upwards higher than it can normally jump.
You will need to save the following resources to your user space (preferably the same folder that you have used for all of the other game resources,
- mushroom.gif - the bouncy mushroom graphic
- bounce.wav - a bouncy sound to play when the event occurs
Create a sprite called spr_mushroom and load up the mushroom graphic that you have saved (or find an image of a similar size to use instead.
Add a sound called snd_bounce and load the bouncy noise that you saved earlier.
Create an object called obj_mushroom and load the mushroom graphic,
The bounce effect occurs when the player character makes contact with the mushroom. Add a Collision Event with the mushroom object to the character object window. You will need 2 events.
First drag in a Play Sound action and play the bouncy noise.
Now we send the player flying into the air by monkeying around with the vertical speed. By setting the vertical speed to a negative number, the character goes flying up the screen.
Place a few mushrooms in strategic places in the game room, save and test the new game feature.
Note: the mushrooms don't move. It is therefore perfectly possible to use a tile graphic over a place holding block object similar to what we did for the platforms. You could also create a different effect using some basic animation in the sprite.