0 Favourites

How do I - spawn a random object at a random spawn location

  • Hey guys,

    I'm in need of a little help! Does anyone know or can point me in the right direction, I'm looking to spawn a random sprite object at a random spawner location so to put this in context;

    I have a row of spawners in a layout, and a number of different sprite objects, what I'm wanting to do is every x secs, pick one of the objects at random, and then spawn that object at one of the spawner location which is also picked at random.

    Humm, I'm going around in circles at the moment so any help would be very much appreciated!

    Cheers!!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I had The same question and went and read The family chapter un The manual. If you put them all in a family and Then set The event create objet and select Thefamily as The object it will Take a random object from The family and créate it.

  • I had The same question and went and read The family chapter un The manual. If you put them all in a family and Then set The event create objet and select Thefamily as The object it will Take a random object from The family and créate it.

    Yeah, that's how you can spawn random object. For random position, I think the easiest way is to spawn it using random X and Y like X(random(0, 300), random(0, 400)), etc.

    Another way is that you can create some random spawn positions on the screen and numbered it. After that, create new object in random positions that you already set.

  • 2dbrando84

    here the sample:

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