5 Spikes & Fire
Platform games usually have items which cause the player to lose a life or lose health. In our game, hitting a spike or fire will lose you some health and send you back to the start of the level.
Graphics & Sound
- fire2.gif - an animated fire graphic
- spike.bmp - a simple spike graphic
- uhh.wav - a sound that indicates pain
Save these to your user space before using them.
Start by making a sprite called spr_fire and load the fire graphic.
Create an object using this sprite and call it, obj_fire.
The fire graphic is animated so that the flames flicker. If you place 2 of these graphics next to each other they will flicker at exactly the same time. That looks a bit odd. You can sort this out by starting the animations at a random point. Do this by adding a Create Event to the fire object and dragging in a Change Sprite action. Fill the pop-up in as shown below,
Now add a sound called snd_uhh, importing the sound file you saved earlier.
Go to the obj_character object window and add a Collision Event with the fire object. We will need the following actions for this event,
- Reduce the health by 25%
- Set the horizontal speed to 0
- Set the vertical speed to 0
- Move the character back to the start
- Play the uhh sound
The following screenshots show how these actions have been made,
Add some of the fire object to the room in a little fire pit somewhere and test that the game works as expected.
The spikes should work in exactly the same way as the fire. Using the example of how you made the fire, add sprites and objects to the game for the spikes.
This is a good opportunity to work out any other non-moving obstacles for the game. Search for and download some royalty-free graphics from the WWW, the network or from some of your previous games to use in the game.