How do I add a pause button?

Hi everybody I have two issues, they are related so im gonna ask in the same post:

1.- I want to add a “pause” button that when you click on it, the game pauses and show some buttons (Back, Exit, Options) while the game screen is still behind but paused.
Things I tried: put the buttons on a hidden second layer, when you click in the “pause” button, it becomes visible. The problem is that I don’t know if there is a way to set a clock to 0 in just one layer.

2.-After I added the “pause” button, I noticed that I did something wrong because it “activates” without doing anything (not always), my conditions were “release” to show the second layer, but once you have clicked one time, then the pauses button are shown.

I think the solution for this could be just “one click”, but I don’t find an event like that.

Thanks :smiley:


PauseButton.gdg (30.8 KB)

No, you can pause the entire game only (through the time scale as you are doing I guess). Continue reading, there are good news.

Maybe the condition “Trigger once” (Advanced >> Trigger once)?, but the button release condition is triggered just one time so it will not be helpful.
I’m testing your game now (please, next time attach the basic resources/sketches in a zip file), and everything works fine :confused:

*The next version of GDevelop will (if I’m not wrong) support scene stacking, as you can see in the roadmap and github: Plus many other cool things you can do, you’ll have the ability to stack your game scene to go to a pause scene, your game scene will be paused and you’ll be free to do whatever you want in the pause scene without have to scale the time to zero, finally you’ll be able to go back to the game scene. So keep doing your work, I just want to give you nice news that someday pause a game will be straightforward :smiley:

Thanks for the answer :smiley: , I solved the second problem, I forgot to add the “touch or ___ button is down” event.

But I still can’t figure how to solve the first one, I set the clock to 0, but the game functions are still activated. I don’t know what to do to “block” an event or an object. Although an object is hidden or behind the “pause background”, I still can click on it so the game mechanics are still active. i.e.: I can click multiple times on the pause button to turn the “Pause background” darker or click the fly.

Any idea of what can I do? :unamused:
PauseButton.rar (16.7 KB)

I solved it :3 using variables, now it works exactly how I wanted