Three Lives, Then You’re Out…

If you were unfortunate enough to be caught by one of the monsters in the game, you may have found it rather unsatisfying to have the game immediately end – you may have had the feeling that a slip of the keys was to game, or a miscalculation about the speed of the monster that you won’t fall for again.

The majority of arcade style games in which the player character can be “killed” offer the player the chance to play again. So common is the idea of “three lives then you’re out” that it could almost be described as a convention – and something that players will expect the game to offer.

So how can we introduce the notion of lives into our maze game?

As in Who’s Best? Keeping Track of High Scores and Upping the Stakes – Bonus Points, we will call on a controller object to manage the lives of our player character. Create a new controller object (controller_lives, for example; no sprite required) and add the following events:

– from the Event Selector, choose Other and then Draw Lives No More Lives. You will need to add two actions to this event: Display a message (“You lost *all* your lives!”,maybe?!), which can be found in the Info panel of the main2 actions tab; and an End Game action, from the Game panel of the same tab;

– again from the Event Selector, choose Draw, and add the Draw the lives as image action from the score actions tab. Double click on the Draw the lives as image action to raise it properties dialogue, and put in the co-ordinates of where you would like the lives counter to appear on the screen. Select an appropriate image for the life counter (for 3 lives, 3 images will show…)

Now add the controller object to the room (it doesn’t really matter where). The controller object will manage what happens when you lose a life, or when your lives run out. But how do we get our lives in the first place? And how do we lose them?

In the player object (obj_player), add a Create event, containing the Set lives action from the score tab; set the number of lives to 3. When an instance of the player object is created, it will now be initialised with three lives.

To lose a life, we need to revise what happens when a monster collides with the player character. Still referring to the player object, select the appropriate Collision Event, remove the End Game action (this is now being managed by the controller object), and add the following actions: Set Lives (from the score tab, and with the properties “relative to -1”); and Jump to Start (from the move tab).

Run your game. Hopefully, you should find that you now get three chances to cross the room. If a monster catches you, your player character is returned to the point at which it entered the room.

Does the addition of multiple lives improve the playability of the game. I certainly found it less frustrating when I got caught, knowing that I’d be able to have another go (having possibly worked out how to get round a particularly trickily placed monster!)

How important is the number of lives that a player is given? Why do you think the game might be less satisfying if the player had four or five lives, for example?

As well as losing something – lives in this case! – we also want our player character to be rewarded in some way as they progress through a room, so that the player can gain some sort of points scoring reward even if they don’t manage to cross the room completely.

In the next post, I’ll show how to add some ‘treasure’ to the room that will reward the player with points as they collect the treasure items.

In the meantime, what do you think should happen when a player collects (i.e. collides with) a treasure object? What objects, sprites, events and actions will we need to add to the game in order to implement “treasure”? ;-)

[Screenshots missing – I will add them by first thing tomorrow morning…]

Advertisements

3 Responses to “Three Lives, Then You’re Out…”


  1. 1 Chris May 17, 2011 at 6:49 pm

    Great – I have all this working and am very pleased. I have one question which you might be able to help with.

    I have set the lives to three, but if I lose a life in Room 1 when I move onto room 2 I am again restocked with 3 lives, assumedly because it is creating a new instance of the player character.

    How can I make the lives carry over to the next room?

    Thanks

  2. 2 Karl May 29, 2011 at 5:24 pm

    Hi Chris,

    I’ve come up with a solution to this. First, remove the “set lives” create event from the player object. Then, set up a new controller object without a sprite. To this controller object, add the “set lives” create event.

    Finally, place this new controller object somewhere in your first room (and only in your first room). Now, when your first room is created you lives will be set to three, but won’t be reset to three when you go to the next room!

    Regards,
    Karl

  3. 3 Juan June 19, 2011 at 4:40 pm

    mine doesnt work…. i do everything just as it says…word for word.. and still it won’t just do it, very frustating if you ask me, i dont know what is wrong


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Categories


%d bloggers like this: