Pausing & "Else" Condition Problem

0 favourites
  • 1 posts
  • Hello hello. So I'm trying to create a pause function. I figured it'd be as easy as:

    +Keyboard: On spacebar pressed

    +player.state = "idle"

          +Pause = 0

                -> Call Function "Pause"

          +Else

                -> Call Function "Unpause"

    However, when I try to pause in game, nothing happens. I take away the "Else" segment, and then it pauses just fine, but leaves me unable to unpause. I think what's happening is the game checks to see if Pause = 0, then runs the "Pause" function, and then immediately after it checks to see if Pause =/= 0, and then runs the "Unpause", all before the next frame is drawn so it appears as if nothing happened. Both functions work fine on their own when triggered, it's only when I try to use an "Else" type deal.

    Also tried:

    +Keyboard: On spacebar pressed

    +player.state = "idle"

          +Pause = 0

                -> Call Function "Pause"

          +Else

          +Pause = 1

                -> Call Function "Unpause"

    +Pause = 0

          +Keyboard: On spacebar pressed

                -> Call Function "Pause"

    +Else

          +Keyboard: On spacebar pressed

                -> Call Function "Unpause"

    ... and other variants of the above with the same result of nothing appearing to happen.

    I thought "Else" was designed to run the event if the previous event didn't run, but that doesn't seem to be the case here. Is this a bug or am I just doing it wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)