is there a "wait"action?

For questions about using Classic.

Post » Sun Apr 04, 2010 11:00 pm

another question, is there a "wait" action like "wait X seconds/minutes" or "X frames"?
B
10
G
2
Posts: 33
Reputation: 1,091

Post » Sun Apr 04, 2010 11:25 pm

Wait object, unstable build (dunno if it's in the stable one).
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sun Apr 04, 2010 11:34 pm

Kind of, there is the "every x miliseconds" object. Using it you can make something wait.

I will give an example with psuedo code.

Player presses "Space"
Player.value('iswaiting') == 1

if player.value('iswaiting') == 1
Every 100 miliseconds
player.value('waittime') + 1

If player.value('waittime') == 10
player.value('iswaiting') ==0
player.value('waittime') == 0
perform wanted action


Basically, there are two variables. The one that tells the game if the event needs to wait, and the one that tells how long it needs to wait. Every amount of time tell the game to add one to the waiting time variable, when it equals lets say... ten, that is 10x. If x=100 then that is 1000 miliseconds you have waited, or one second. That is the only way I know how to do it however. I hope this helps.
B
2
G
3
Posts: 46
Reputation: 942

Post » Mon Apr 05, 2010 3:43 pm

thanks, that may help as long as wait object is improved
B
10
G
2
Posts: 33
Reputation: 1,091

Post » Mon Apr 05, 2010 4:20 pm

[quote="Fresh Frijoles":1i8t7fay]Kind of, there is the "every x miliseconds" object. Using it you can make something wait.

I will give an example with psuedo code.

Player presses "Space"
Player.value('iswaiting') == 1

if player.value('iswaiting') == 1
Every 100 miliseconds
player.value('waittime') + 1

If player.value('waittime') == 10
player.value('iswaiting') ==0
player.value('waittime') == 0
perform wanted action


Basically, there are two variables. The one that tells the game if the event needs to wait, and the one that tells how long it needs to wait. Every amount of time tell the game to add one to the waiting time variable, when it equals lets say... ten, that is 10x. If x=100 then that is 1000 miliseconds you have waited, or one second. That is the only way I know how to do it however. I hope this helps.[/quote:1i8t7fay]

Instead of doing all that, why not just call a function after delay? You know the Function object?
Function object on the wiki

[quote="lestar":1i8t7fay]thanks, that may help as long as wait object is improved[/quote:1i8t7fay]

I'd suggest you just use the most recent version of Construct. It doesn't make much of a difference if it's marked stable or not. Version 0.99.84 is being used by many people here on the forum and it shouldn't be considered less stable than 0.99.62. Don't get too hung up on formalities.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Mon Apr 05, 2010 4:37 pm

Yeah, you can do this easily using the Function object!

Use the "Call Function After X ms".

Function object rocks!
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Mon Apr 05, 2010 5:05 pm

jeje, thanks you very much, i didn't know about that object, it was there all time and i didnt see it :B
B
10
G
2
Posts: 33
Reputation: 1,091


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests