[SOLVED] How do I randomize objects spawning?

Get help using Construct 2

Post » Sun Dec 14, 2014 4:54 pm

So I have objects A, B and C.
I've assigned object A to spawn another object which is B when it gets destroyed.

But what I want is when object A is destroyed, I want it to randomly spawn object A or B or C.

Thank you.
Last edited by chrisimnida on Sun Dec 14, 2014 5:45 pm, edited 1 time in total.
B
4
S
1
G
1
Posts: 2
Reputation: 329

Post » Sun Dec 14, 2014 5:28 pm

You should create a new global or local number type variable (let's just call it "wheretospawn") and at the event:
Object A destroyed: System -> Set Value (wheretospawn) -> int(random(3))
Then insert 3 sub events:
System -> Compare variable (wheretospawn) -> =0
System -> Compare variable (wheretospawn) -> =1
System -> Compare variable (wheretospawn) -> =2

Then for each of these sub-events you add the Create object actions for object A, B, and C.
B
135
S
33
G
17
Posts: 1,560
Reputation: 20,734

Post » Sun Dec 14, 2014 5:45 pm

That worked for me!

Thank you for the clear instructions, cheers!
B
4
S
1
G
1
Posts: 2
Reputation: 329

Post » Sun Dec 14, 2014 5:57 pm

Glad I could help. Happy developing :)
B
135
S
33
G
17
Posts: 1,560
Reputation: 20,734


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests