How do I make something spawn between 4 and 6 seconds?

Get help using Construct 2

Post » Sat Jan 31, 2015 12:47 am

I have on system -- Every random(6) but i want it to be to be randomly between 4 and 6 seconds. What would the code be?
B
3
Posts: 9
Reputation: 193

Post » Sat Jan 31, 2015 12:52 am

random(4,7) -- This will generate a float between 4 adn 6 (because the upper value isn't included in the generation, therefore add an extra number if you want to include it).

Also: floor(random(4,7)) -- This will generate whole numbers between 4 and 6 (same thing with the upper number applies here).
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Sat Jan 31, 2015 12:56 am

i did floor(random(4,7) and it spawns every 2, 3 or 4 seconds
B
3
Posts: 9
Reputation: 193

Post » Sat Jan 31, 2015 1:01 am

I just tested and it works just fine for me. Make sure you've used a comma and not a period.
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Sat Jan 31, 2015 1:04 am

So it would be like floor(random(2,7))
B
3
Posts: 9
Reputation: 193

Post » Sat Jan 31, 2015 1:07 am

That would generate a whole number between 2 and 6.

The first value is the bottom range and the second value is the upper range-1.
Last edited by eliasfrost on Sat Jan 31, 2015 1:10 am, edited 1 time in total.
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Sat Jan 31, 2015 1:08 am

Alright thank you so much. Do you have any games out that you created?
B
3
Posts: 9
Reputation: 193

Post » Sat Jan 31, 2015 1:12 am

Always. I haven't finished anything with Construct yet (apart from prototypes and stuff) but I'm currently working on this: post-screenshots-of-what-you-re-working-on_p873841?#p873841
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Sat Jan 31, 2015 1:21 am

Do you think you will be releasing it
B
3
Posts: 9
Reputation: 193

Post » Sat Jan 31, 2015 1:30 am

Possibly. I don't want to make any promises but we'll see how far I can take it.
B
20
S
8
G
4
Posts: 195
Reputation: 3,555


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests