How do I stop an action from running once started?

0 favourites
  • 3 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I found an issue while trying to program my character to use a jetpack to fly. I basically told it, on jump, make "jumpsequence = 1" (local static variable) and so on another event, when up arrow is pressed, "jumpsequence = 1", and Platform is NOT on floor, (okay, those were the conditions, now I will sum up the actions --> ) basically make him stay in the air. When Platform IS on floor, make "jumpsequence = 0". This allows him to do this action over and over again. This works.. but the problem is this: When he is in the air, I want him to run out of jet stamina and need to land before using it again. So, I programmed it to basically say, "when he is in the air, and flying, wait 4 seconds, then have him drop." However, if the player decides to make him drop early, the "wait 4 seconds" action still runs! So when the player goes to jump and fly again, because the last "wait 4 seconds" is still running, he lands early. I programmed it to basically say, "when player is in air, "EarlyLand" = 1. If "EarlyLand = 1" then it starts the 4 seconds. However, if he lands early and the 4 seconds have already started, and yet when he lands, "EarlyLand = 0" then why does the action "wait 4 seconds" not stop? To sum up my issue, why is it that once an action is started by "a variable equaling 1" you can't stop the action when the "variable becomes 0"? If anyone is too confused about this to help, then I will gladly send a picture of my events. Since this website doesnt allow pics to be uploaded or attached, I would have to send it to you by email or some other means. Thank you.

  • Don't use Wait, you can't stop it. Use the Timer behaviour, and you have full control over it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much blackhornet! It all works now! I had no idea there was a Timer behavior!

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