Why is my toggle not working?

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I don't understand why this isn't working? It seems like it should be simple enough?

    • Global Boolean "Pause" is False on start.
    • When Escape is pressed, if Pause is False, set to True.
    • When Escape is pressed, if Pause is True, set to False.

    In Debug, the Pause boolean stays False and won't change to True. Is there a reason why it's not getting toggled on and off?

    Thanks for your help! :)

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's strange that you asked this question but you didn't use the toggle action hehe. There is a toggle boolean action you can trigger when you press escaped, that would work on its own.

    The reason why it's not working for you here is because in Construct it runs the events from top to bottom so by the time it triggers the second event the variable is set to true and sets it back to false. You can use a sub event with an Else to get this to work, where Xis Pause Else is Pause will trigger only one time, or as mentioned above the toggle action on Escape pressed.

  • Ooh okay! The Toggle action does indeed work, and I'll probably end up just doing that at the end of this just for simplicity.

    But I'm trying to learn how to do different things in Construct, so I'm still learning about Sub-Events and whatnot, and your comment sent me in the right direction! So thank you!!!

    Here's the structure that ended up working:

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