How to make a life system?

Is it possible to make a live system? So what I’m trying to do is when Mario dies, he loses a life, but how to I make a life system when the level restarts?

1 Like

A link to the game would help, but it seems like you would want to make a Global variable to count lives, and everytime the player dies and restarts subtract one from the life counter

when the counter equals zero, restart the entire game

1 Like

@nhgcr_for_the_3rd_time Here is the link to my game, It’s very crappy: Flowlab Game Creator - New Crappy Mario Bros. PC!

1 Like

You can do this in the 1-Up object to increase lives when you collect it

But since you have 3 marios I don’t really know where to go from here other than repeating the exact same code in multiple objects

1 Like

Okay but what object’s behaviours were you in? @nhgcr_for_the_3rd_time

1 Like

The 1-Up object

1 Like

So when I die, the life counter doesn’t go down, may I ask what the code is for losing 1 life? @nhgcr_for_the_3rd_time

1 Like

In either the the Mario objects or a separate object (I would probably do the latter) and when the player does their death animation, send a message that will remove 1 life from the counter

1 Like

Screen Shot 2023-03-23 at 12.10.23 PM
First add this to the end of the death animation

Okay I did that what next?

1 Like


Then add this to whatever object you’re sending the original message to

Whenever the game restarts he still has his three lives for some reason @nhgcr_for_the_3rd_time

1 Like

That’s probably because of the once behaviour, gimme a sec

After the filter to check whether the lives are above 0, If it fails send a message to the 1-Up object

then replace the Once in the 1-Up code with a Mailbox to receive the message

New 1-Up code

New counter object code

May I ask how long is the timer? @nhgcr_for_the_3rd_time

It’s all the default settings

Also I would recommend making a separate object to put the lives code into instead of putting it into the music block

Okay so I did that, but for some reason the label starts at zero and not three @nhgcr_for_the_3rd_time

1 Like

hm

Where did all your death code go?

(In the mario object)

Its in a bundle, called death for mario ig. @nhgcr_for_the_3rd_time

1 Like