which expresion to event?

Get help using Construct 2

Post » Thu Apr 05, 2012 11:40 pm

I want something like this every 3-6 seconds do something
i use int(random(3,6)) and this doing something only every 3 seconds
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Fri Apr 06, 2012 2:57 pm

and second question how spawn object always in center of window ?
B
170
S
3
G
2
Posts: 65
Reputation: 6,057

Post » Fri Apr 06, 2012 3:02 pm

Your random expression looks fine to me, might have to see your .capx to find the problem. If you want to spawn something in the center of the window, you can use "WindowHeight/2" and "WindowWidth/2".
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Fri Apr 06, 2012 3:11 pm

if you do your event "every random(3,6) seconds" it won't do what you want, because random is evaluated only once in this case and then the "timer" is set on that value.

You might need to use System.wait ACTION (not condition / event), and probably you need to modify your game logic a bit to switch from every (random) seconds to wait (random) seconds.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Fri Apr 06, 2012 3:15 pm

I tried every radnom (3,7) seconds, every choose (3,4,5,6) seconds, and every private variable X = random (3,7), there is no way to set something every radnom seconds with Every x seconds expresion...You must triger it by calculating time of action(do something), curent time, and random time period.

Do something if curent time=action time+radnom time, then set action time to curent time, set new radnom time period...

less words more action

p.s.
random from 3 to 6 is radnom(3,7)




edit: update capx now is more readablepodpathos2012-04-06 15:56:14
B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Fri Apr 06, 2012 3:29 pm

podpathos I was afraid there will be no simpler solution than using a global variable

Nimtrix Thanks its working fine :)
B
170
S
3
G
2
Posts: 65
Reputation: 6,057


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, mallorcaredes, ultrafop and 3 guests