How do I Randomly spawn objects at set positions

Get help using Construct 2

Post » Fri Apr 01, 2016 1:26 pm

How do I Randomly spawn objects at set positions

I want everything in my layout to randomly spawn with a limit -like 10 trees and 5 rocks-
B
51
S
33
G
19
Posts: 59
Reputation: 14,294

Post » Fri Apr 01, 2016 5:22 pm

The objects will spawn in a set X,Y? If yes, you can create a Function - the same way you create a sprite, or anything else -, then go to you event sheet, include your functions, and call them at random. Like this:

imgur.com/kVGNSTa

Of course that you'll set what your function does. To call them randomly, just create an action with "Call Function ------ choose("funcX","funcY", "funcZ")", and it will pick one of them randomly.

imgur.com/7o9FP7r

To make it spawn a limited set of times, set a local variable that whanever the object is spawned, it has 1 added to its value, then put another condition on your function that says "X<5", by example.
Riding the Rainbow for all the eternity
B
10
S
5
Posts: 31
Reputation: 934


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Artcadev, Blendi1223, PROxMTswatTR and 27 guests