Solved my own problem

0 favourites
  • 4 posts
  • Edit: I was trying to figure out how to make my game pause and unpause. I couldn't find any tutorial regarding unpausing. I found toggle_switch, and made it work using that.

    <img src="http://i44.tinypic.com/2zggpvr.png" border="0" />

  • If you're doing this the way I think you're doing it then I believe I've encountered a similar problem before.

    The solution for me was to have the pause/unpause key toggle the boolean global variable instead of setting it to 1 and 0 because what happens is Construct will run through the events and the last even to be executed will have the final input on what the global variable will be.

    Here's the solution:

    On "p" pressed: toggle boolean global variable

    subevent: boolean global variable = 1: pause

    subevent: boolean global variable = 0: unpause

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add an else condition between the two statements.

    Problem:

    If pause 0, pause = 1

    If pause 1, unpause = 0

    You are effectively pausing the game and unpausing the game in the same action, because the events are read from top down.

    Adding an else condition to the second event will cause only one of those to be read per tick.

    Solution:

    If pause 0, pause = 1

    Else, if pause 1, unpause = 0

  • If you are using the free edition, sushin's solution will save precious events, just be sure to add the key press as a condition in addition to the "if" checks.

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