Create objets at random time

For questions about using Classic.

Post » Fri Oct 07, 2011 6:50 pm

Hi,

Here is my problem.

I would like to spawn a sprite every (random milliseconds between x and x milliseconds)

Is it possible?

Thx
B
1
G
1
Posts: 8
Reputation: 491

Post » Fri Oct 07, 2011 7:11 pm

In theory you could have a global variable, say "Delay" and have something happen Every "Dealy" ms. And every time it happens assign "Delay" a random value in the given range. If it was, say between 40 and 60 ms do a "Delay" = 60-Random(21)
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Oct 10, 2011 7:52 pm

I have it where I make a new EVENT > SYSTEM, Time: Every X Milliseconds, 2000 (for example). Then for the ACTION > SYSTEM, Create Object, pick the object, layer 1 (for example), x coor is random(640), and y is 0.

+ System: Every 2000 milliseconds
-> System: Create object HealthPack on layer 1 at (random(640), 0)
B
5
S
1
G
1
Posts: 157
Reputation: 1,219


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest