Pausing & "Else" Condition Problem

Get help using Construct 2

Post » Sat May 12, 2012 7:15 pm

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?
B
56
S
20
G
7
Posts: 305
Reputation: 8,754

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, MChiz, plinkie, Radulepy and 1 guest