How do I Randomly spawn objects at set positions

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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-

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)