WAIT Action

Discussion and feedback on Construct 2

Post » Sun Jan 01, 2012 11:35 am

I would like to ask a "redesign" of the "WAIT"-Command. To my mind, it is quite unpredictable how to use it. What I am unable to grasp is, why cant it allways does what you expect it to do?!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Jan 01, 2012 11:38 am

If you're asking for a re-design, you will need to provide a much clearer reason for it, preferably with example(s). At the moment, it just looks like you don't like the way it works, which is hardly a good reason for change.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,850
Reputation: 48,301

Post » Sun Jan 01, 2012 12:00 pm

Extract from the system actions manual entry

Wait
Wait a number of seconds before continuing on to the next action or sub-events. Other events continue to run in the meantime. See also the tutorial on How to use the System 'Wait' action.

At first I was a bit lost too, but after having read the 'Wait' action tutorial, I think I finaly grasped how it works.
It's tricky at first, but imo needs no re-design. It works as expected when used properly.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sun Jan 01, 2012 12:55 pm

It has a well defined and predictable way of working, you probably are just assuming it does something else.

'Wait' means 'pause the current event and come back to it after a delay'. The rest of the events keep running in the mean time. So if you use 'Wait' in a loop, the loop finishes instantly, because 'Wait' doesn't stop the rest of the events running. Any actions after the 'Wait' complete as scheduled.

I think people keep assuming it stops running the rest of the events during the wait. It can't possibly do that, because it would make it nearly useless - the whole game would hang during the wait...
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Jan 01, 2012 12:57 pm

I think the function is not universal. Depending on the "position" within the "codestream" it will be executed or not. And it seems, that you just can not use it to slow down loops....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Jan 01, 2012 12:58 pm

espercially the loop part seems akward to me....
I am compiling an SimonSays Tutorial right now, and slowing down the "playback" loop with WAIT just didnt work...
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Jan 01, 2012 2:56 pm

In the case of a Simon you have to think at the tick level.

On the start tick of the turn, the computer computes the sequence order.
Then for the following ticks, it will playback the sequence. During those ticks, the user must not input anything (or you don't take it into account).
Then for the following ticks, it will wait for the player's input.
On the tick the player's input is done, you compare the inputed sequence to the computed sequence.
If the two matches, you go to the next turn and compute a new sequence.
If the two doesn't match, you reset the inputed sequence and allow for the user to input a new sequence.

It's not a matter of wait action here, but of state/status of the intended step of the behaviour of your logic.

A capx to illustrate (not flawless, but should help with the methodology)Kyatric2012-01-01 16:25:23
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sun Jan 01, 2012 3:01 pm

Oh, I came up with a solution and the tutorial is done. Anyhow, "WAIT" jsut does not feel consistant to me....
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Jan 01, 2012 6:51 pm

Wait always works exactly the same no matter where it is placed. Can you post an example of 'Wait' not doing what you want?

You can actually use Wait to space out loops - try this:

+ Repeat 10 times
-> Wait loopindex seconds
-> Do something

The loop runs instantly, but sets up 10 "Wait 0 seconds then do something... Wait 1 seconds then do something... Wait 2 seconds then do something..." so the rest of the actions complete as if the loop was spaced out in time.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Jan 01, 2012 7:44 pm



Based on "normal" programming experiece I would expect the sprite to flash - it doesn't....

This is the first thing I really don't understand, even thou I have no problems with the event based concept - I think
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Next

Return to Construct 2 General

Who is online

Users browsing this forum: pablo7, Yahoo [Bot] and 16 guests