How do I cancel a wait action when retriggering the conditio

Get help using Construct 2

Post » Fri Sep 19, 2014 8:02 pm

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 !
B
23
S
5
G
1
Posts: 335
Reputation: 2,406

Post » Sat Sep 20, 2014 4:50 am

try using the timer behavior instead of the system wait.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sat Sep 20, 2014 5:07 am

Thanks, I'll try that !
B
23
S
5
G
1
Posts: 335
Reputation: 2,406


Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher, wizdigitech, Zamargo and 13 guests