Adding a Lives System in Game Maker 7

TIME : 2016-01-07
Adding a Lives System in Game Maker 7

Game Maker handles lives through built-in actions, so you can put a working system together without writing a single line of GML.

Setting Up the Basics

  • Select the object that needs to track lives.
  • Open the Control tab.
  • In the Create event, add a Set Lives action and choose the starting number.
  • Still under Control, open the Other category and pick the No More Lives event. Attach a Destroy Object action, or whatever you want to happen when the counter hits zero.
  • To actually lose a life, go to the relevant event — a collision with an enemy, for example — add Set Lives again, enter -1, and tick the Relative box so it subtracts rather than overwrites.

Showing the Counter on Screen

There are three common approaches:

  • In the Create event, use the Score Caption action and enable the lives display.
  • Create a separate object with a Draw event, then add Draw Lives. Tick Relative to draw at the object's own position, or type explicit x and y coordinates.
  • Prefer icons over numbers? Do the same as above, but instead of Draw Lives, make a small life sprite and use Draw Life Images, then pick the sprite and where it should sit.

None of it is complicated once you know which tab each action lives in.