How do I cancel a wait action when retriggering the conditio

  • Hi Everyone,

    I've run into a new problem that I didn't manage to resolve by myself. Here is the simplified code :

    When spriteButton is touched (trigger once), set Object.instanceVariable to true (can only be triggered once by half second, with a cooldown mechanism)

    "Object" spawn object "icon"

    wait 4 seconds

    "icon" start flashing for 1 second

    wait 1 second

    delete icon

    set object.instancevariable to false

    This works perfectly as long as I never repress the button while the script is running, but I would like the player to play the script multiple times during the initial 5 seconds.

    As it is, when I re-run the script while it is still active, a second icon will be created and the instancevariable will be set to false 5 seconds after the first launch, because the first script is still running and will set the variable to false

    So my question resumes to : How can I cancel a wait time (or a whole event) in order to start a new one with the wait time back to 0?

    I tried putting the wait part inside a group and deactivationg the group then reactivating it, but it doesn't seems to work.

    Thanks for your help !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • try using the timer behavior instead of the system wait.

  • Thanks, I'll try that !

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