How to discard a waiting action?

0 favourites
  • 3 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • Hi,

    In my game, my character would lose health and become invulnerable in 3 seconds if enemies touches him. My solution is using a boolean variable "IsVulnerable" and set it to false when the character collides with enemies. Then, I call System-> Wait for 3 seconds and set it to true again. The character also has the ability to create a shield that makes him invulnerable in 8 seconds, for which I use the same method. The problem is, if he touches enemies and get invulnerable, then activates his shield 1 second later, he would be vulnerable again after 2 seconds instead of 8 due to the action following "Wait for 3 seconds" action. To solve this, I'm looking for a way to discard the waiting process, but haven't found yet. Is it possible?

  • In general it's best to avoid using the wait action, especially in situations where it might be interrupted. Instead, add the timer behaviour to your character. Remember to give each timer you start a different tag. You can then use the "stop timer" action to cancel the timer for a given tag.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! Didn't try that behavior.

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