How to use wait correctly

Get help using Construct 2

Post » Fri Nov 22, 2013 9:26 pm

I read the manual about wait and some other forum topics. But i'm still not sure how to use wait correctly. For example i just want to run a loop like this and wait a little bit on every step. Thanks.

https://db.tt/yT3rbzZq
B
21
S
8
G
6
Posts: 177
Reputation: 8,124

Post » Fri Nov 22, 2013 9:33 pm

You are far better off using the Timer behaviour. Wait is the most misunderstood & misused mechanism C2 has, in my opinion. People expect it to block, but it does not (the whole game would lock up if it did).
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Sun Nov 24, 2013 8:55 pm

@blackhornet @Ashley
Thank you blackhornet. I give data structures lessons. And i planned to create some interactive sorting algorithm animations. So i need to use complicated loops and show some values in the loop at every step.

I created another test. This example is very similar to Ashley's tutorial

The example in tutorial
+ On start of layout
+ Repeat 10 times
-> System: wait loopindex seconds
-> Text: append text "Time = " & time & newline


Here is mine
but it didn't works( If you disabled the wait, it works normally)
mrcgkh2013-11-24 21:34:31
B
21
S
8
G
6
Posts: 177
Reputation: 8,124

Post » Mon Nov 25, 2013 12:19 am

The problem here is that loopindex is maxed out right away, so that when each Wait runs, it is at the final value.

waittest2_BHT.capx
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Mon Nov 25, 2013 7:22 am

Thank you so much @blackhornet. I changed the first inner loop example.Now it works great.

mrcgkh2013-11-25 07:23:27
B
21
S
8
G
6
Posts: 177
Reputation: 8,124


Return to How do I....?

Who is online

Users browsing this forum: ivanski1983, KTML5, Yahoo [Bot] and 3 guests