how do I toggle stop and go

0 favourites
  • 4 posts
  • I have a sprite that is constantly moving forward, and I want to click it to stop it, and click it again to make it move again, and I can't get it to work for the life of me! I've been messing with values and boolians and i can't figure it out.. this should be easy

  • Give the sprite an instance variable called something like "Moving" which stores a boolean value. Set it's default to true. When the toggle action happens, set it to false when it is true and use a System Else event to Toggle it back to true. You need to use the Else event so it doesn't just immediately switch back to the previous state.

    [attachment=0:29zx9sxd][/attachment:29zx9sxd]

    A lot of times, people try to just say, if true set false, if false set true but what this does is, when the event triggers for true, it sets the value false and since right after setting it false, it checks to see if it is false it triggers the second event setting it right back to true.

  • thank you so much! I've seen the else event before.. but I cant remember how I got it to appear.. is there something I'm missing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nevermind found it, thanks again!

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