Wait bug or not ?

Discussion and feedback on Construct 2

Post » Tue Apr 02, 2013 12:58 pm

Tutorial: Wait Tutorial

This is given in the Tutorial:
+ Repeat 10 times
-> System: wait loopindex seconds
-> Text: append text "Time = " & time & newline

This is what I make:
+ Repeat imagePointCount times (4, and yes 4)
-> System: wait 2 seconds
-> Spawn something on image.imagePointX(loopindex)
-> Console.Log("ARRR")

What it does:
-> Second 1:
--> nothing
-> Second 2:
--> Spawns something on the first imagePoint
--> Logs 4 times "ARRR"
-> Second 3:
--> nothing
-> Second 4:
--> nothing
...


For me it seems like Wait dont work.
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Tue Apr 02, 2013 1:23 pm

It works, but as loops run ALL of their loops in single tick, all of your prints will wait for the exact same 2 seconds before appearing. So as tutorial demonstrated, add 'wait loopIndex seconds' instead of wait 4, and you'll get one text every second.
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Tue Apr 02, 2013 1:23 pm

Coincidentally, I just added the system wait function in a loop index on Thursday, using the latest beta release v123.2. There's no problem with it for me, it works perfectly. It could be something else in your capx.
B
31
S
11
G
7
Posts: 197
Reputation: 6,682

Post » Tue Apr 02, 2013 1:39 pm

@vee41 Forgot to tell you also tried it with "wait loopindex * 2 seconds" and also with "wait loopindex * seconds"

@AndyWatson could you make a example .capx ? Cause I made this in a new project... My Teammate also tried it, he has the same problem in a new clean project.



here is a clean Example:

ExampleDarklinki2013-04-02 13:47:26
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Tue Apr 02, 2013 3:08 pm

Most people misunderstand this aspect of it; 'wait' does *not* suspend the whole event sheet, because it would be useless if it did! (Imagine if your game paused every time you used a Wait action)

So if you have something like this:

+ Repeat 10 times
-> Wait 1 second
-> Append "Tick" to text object

then the loop completes immediately, but schedules ten "Append text" actions all after one second. After one second all ten of them run. Note the original example uses loopindex so it sets up a 0 second delay, then a 1 second delay, then a 2 second delay, etc. whereas you use a constant delay, meaning the entire loop is basically done instantly after a single delay.

Edit: updated the tutorial to make this clearer.Ashley2013-04-02 15:17:44
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Tue Apr 02, 2013 3:58 pm

Any plans to do a official wait behavior like the one David was working on in CC @Ashley?

I would add this would also be very nice to use to solve some of the bunching issues with pathfinder.

newt2013-04-02 16:05:15
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Tue Apr 02, 2013 4:01 pm

I can't remember exactly what it was David was working on, what did the behavior do?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Tue Apr 02, 2013 4:12 pm

It was called Timer behavior. It just had the ability to set up individual timers for instances.
There's a third party plug or 2 that work similarly.
The most useful part being able to have a trigger/condition for when the timer ends.
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Tue Apr 02, 2013 7:10 pm

Isn't that basically what the Wait action does anyway? What's different or better about the behavior?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Tue Apr 02, 2013 7:35 pm

Well I would say the biggest difference is once you start the system wait you are committed to what ever actions are after it.
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Vallar and 8 guests