Create Random Object

Get help using Construct 2

Post » Mon Dec 03, 2012 11:05 pm

I have 5 different objects named 1-5. What I need is for System to create a random one at 5 second time intervals. Is it possible to do it randomly?
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Mon Dec 03, 2012 11:13 pm

you can just put the objects in a family and every 5 seconds create a familyobject .. wich would create a random object of that family
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Mon Dec 03, 2012 11:14 pm

Unfortunately I don't have a license yet and can't make families :/
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Mon Dec 03, 2012 11:40 pm

i see, then you have to create a random number and depending on the number , do a create action

randomnr = 1 > create
randomnr = 2 > create
...
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Tue Dec 04, 2012 12:18 am

This worked, thank you!
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Fri Dec 07, 2012 8:36 pm

[QUOTE=vtrix] you can just put the objects in a family and every 5 seconds create a familyobject .. wich would create a random object of that family[/QUOTE]

@vtrix

I've tried this way, but it doesn't seem to work correctly: I've just 2 objects and it seems that system creates only the last one... am I doing something wrong?

I've:

Button -> OnClicked; System -> Create object Squares on layer 1 at (Random(50, 700), Random(50, 700))


Edit: sorry, the other object was set to not visible by default ^^;Jeff Skyrunner2012-12-07 20:49:43
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
29
S
12
G
4
Posts: 130
Reputation: 4,735


Return to How do I....?

Who is online

Users browsing this forum: BipolarMike, Televangelist, totoe and 21 guests