How do I make a button delay

So I am trying to make a pause button when it’s pressed, it will pause the game and show a pause layer but can also be used to resume the game and hide the pause layer. I run into the problem of the pause layer showing the disappearing after one click.

That sound like you need to use a “Trigger once while true” with your click on the button conditions

I have the condition already in my script but it doesn’t work,

Can you provide a screen shot of the events?

The way the GDevelop will run this is:

  1. It looks at the first event. It sees Esc is pressed and pause = 0, so it sets pause to 1.
  2. It looks at the second event. It sees Esc is pressed and pause =1 (it was set it in the previous event), so it sets pause to 0.

I don’t think this is how you want it to happen, right? Try the following - it’ll give the result you’re after:

1 Like

I use the keypress delay timer.
image
obviously with each touch it resets the timer, so you have time to click and lift your finger

What I do and it works (I just tested it) is starting the variable “pause” with a value of 1 and multiply the variable by -1. That way it will always give you the values 1 and -1.

2 Likes