How do I open and close Pause Menu with one controller button (start button)?

0 favourites
  • 5 posts
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • Hey there!

    I'm trying to create a Pause Menu for my game. I want it to open with the Start button on the controller and close with the same button. Currently, when I press the button, the game pauses, and when I press it again, it resumes, but the menu doesn't appear. How can I fix this issue?

    Thank you!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That's because you check if the layer is visible at every tick, so when you press Start the actions that make the menu visible run first, but are then immediately followed by the actions that make that same menu invisible.

    To fix this, write as main condition:

    On gamepad 0 Start / Menu pressed OR On Escape pressed

    then, insert two different sub events:

    - if Layer "PauseMenu" is visible -> display pause menu

    - Else -> hide pause menu

  • That's because you check if the layer is visible at every tick, so when you press Start the actions that make the menu visible run first, but are then immediately followed by the actions that make that same menu invisible.

    To fix this, write as main condition:

    On gamepad 0 Start / Menu pressed OR On Escape pressed

    then, insert two different sub events:

    - if Layer "PauseMenu" is visible -> display pause menu

    - Else -> hide pause menu

    Like so? If it is; the result is still the same.

  • That's better. I notice that you have set timescale 0, but at the same time you try to perform a tween. That's what causes the issue. With timescale = 0, your tween simply stops executing, and that means that your menu will never re-appear. To fix this, filter out the menu from the global timescale. Just enter set object timescale = 1 for the objects that are supposed to move when pausing. Like this (I tested and it works as expected)

  • That's better. I notice that you have set timescale 0, but at the same time you try to perform a tween. That's what causes the issue. With timescale = 0, your tween simply stops executing, and that means that your menu will never re-appear. To fix this, filter out the menu from the global timescale. Just enter set object timescale = 1 for the objects that are supposed to move when pausing. Like this (I tested and it works as expected)

    It worked, thanks a lot! You're a lifesaver <3

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)