How do I randomly choose premade objects?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have a set of premade objects. The objects move across the screen at X speed. I want to make it so whenever the current object on screen reaches X on the X-axis it will randomly pick one of the other premade objects to begin behind it to create a infinite loop but with random order by which the objects appear.

    Say I have 'ground1' moving across the screen, once it reaches X on the X-axis, I want it to randomly choose one of the other objects from a list to create a object following 'ground1' such as 'ground4' and when 'ground4' is at X to load another random 'ground' object to follow it.

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If they are different types of objects, you can add them to a family, and if you spawn from that family, it randomly chooses one.

    Without the full version, you can use a local variable and assign it a value with floor(random(2)) and then If var == 0 spawn ground0; elseif var == 1 spawn ground1 elseif var == 2 spawn ground2 etc.

  • If they are different types of objects, you can add them to a family, and if you spawn from that family, it randomly chooses one.

    Without the full version, you can use a local variable and assign it a value with floor(random(2)) and then If var == 0 spawn ground0; elseif var == 1 spawn ground1 elseif var == 2 spawn ground2 etc.

    Makes sense. Thanks. Looks like its time to purchase a license.

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