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-
Posts: 77
Reputation: 16,011

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:

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.

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
Posts: 31
Reputation: 934

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests