On key pressed/down/on released but for Global #s?

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi,

    I've been stumped searching for an answer and it's been hard to even phrase the question but I think I've got it now.

    I am trying to setup a state machine based on GlobalNumbers. It's easy enough to tell it when to switch from one to another but I'm wondering if there's a way to monitor not only when it's on and off but whenit switches on and off.

    The best example is in the way Construct 2 monitors a keyboard. That I can watch for when it is first pressed, when it's on and when it's released:

    <img src="https://dl.dropboxusercontent.com/u/1587144/Scirra/Keyboard.JPG" border="0" />

    I'd like to set up this same behavior but with a variable, like below:

    <img src="https://dl.dropboxusercontent.com/u/1587144/Scirra/Spacebar.JPG" border="0" />

    I want to watch for when the Spacebar variable switches from 0 to 1, when it's on 1 (can do this already) and when it switches from 1 to 0.

    Is this possible and if so, how?

    Thanks in advance for any help.

  • <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/triggerVarChanged.PNG" border="0" />

  • here's a simple solution

    basicEventBasedStateMachine.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome, thanks so much!

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