Creating a Revive button that can be used only once

Hey guys,

So I am messing with the example game GEOMETRY MONSTER by adding different stuff.

This time I tried to add a revive button. Basically when you die the game over scene pops up with the following buttons.

When you click the revive button, an ad shows up and the buttons/game over are hidden and you can resume playing the game with 3 lives. Now the thing is, when you die again the Revive button is still there. Well, they are supposed to… since as you can see in the below image each time the monster dies the game over and the other 3 buttons show up.

Now my issue is…

You basically die 2 times,

On the first time you click revive, keep playing and then die again.

When you die for the second time I don’t want the revive button to be there.(Since you will end up with unlimited revives)

Any easy way I can do this? I tried searching for tutorials but I only found how to add the revive buttons or how to add ads etc. I still don’t know much about Gdevelop so if anyone could suggest a solution I would really appreciate it.

Maybe you can tell me how your REVIVE button works on your games?

I would just add a global or scene boolean variable called ‘revive’ and set it to TRUE by default. When the Revive button is clicked, check that the ‘revive’ variable is true. If so, show the ad and restart the game. When you show the ad, also set the ‘revive’ variable to FALSE. Then it can only be used once.

1 Like

What @anon14980890 wrote means the player can use the revive button only once in the game. However, if you want the revive button to be available again if they start the level from scratch, then you’ll probably want to add an action when the main or retry buttons are pressed that sets the revive variable to true.

1 Like

Yeah, I kinda plan to follow your way since I want the player to be able to restart the game without going back to the main menu. I should research the true/false actions more, I never tried them to be honest.