setTimeout() ?

Get help using Construct 2

Post » Tue Jul 11, 2017 3:28 am

Do we have something like setTimeout() function?
Because I can't use Wait for the Function plugin (in the manual says how it works with functions and in my case it's a problem and local variables doesn't work)
Now is there a solution to this, because Its doesn't work:
Image
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Tue Jul 11, 2017 3:35 am

Look at the Timer behaviour.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Tue Jul 11, 2017 4:19 pm

blackhornet wrote:Look at the Timer behaviour.

I have tried Timer but It doesn't work in this case. That picture I showed is part of the "branch" function ("branch" function is a recursive function) and if I want to use Timer then I have to bring all the function's local variables, and that timer is going to happen multiple times for each branch which would stop the previous timers as well as the variables I have to carry to Timer will change for a branch which the change wasn't meant to be
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Tue Jul 11, 2017 5:34 pm

Create a new object each time, store any instance variables you may need, use it's timer, destroy the object when the timer expires. You can have as many unique timers as you want.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Tue Jul 11, 2017 5:42 pm

blackhornet wrote:Create a new object each time, store any instance variables you may need, use it's timer, destroy the object when the timer expires. You can have as many unique timers as you want.

If I want to do that then the amount of objects in the screen would be way too much (The object is Canvas) and it would affect the performance. I used setTimeout() with the execute Javascript action from Browser and it works perfectly. Thanks for the suggestions.
B
45
S
19
G
3
Posts: 102
Reputation: 4,598


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 29 guests