How do i make a random object spawn just one instance of x object, and then destroy itself?

0 favourites
  • 2 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Me and my mother who's a teacher are making an "educational" game for her school.

    Currently i'm trying to make the objects, which in this case are fruits, spawn in random, determined places

    (Determined by the "Fruit Spawner Objects")

    While i think the logic behind the while loop and the spawnObject function are sound, for some reason i cannot comprehend, sometimes the fruit stacks, and not all fruitSpawners are destroyed, i've tried a number of things with no luck whatsoever, can anybody help me?

    Video of the problem (You can see that in the last few seconds the apple and the blueberry appear in the same spot, and one fruitSpawner instance is left.): i.gyazo.com/b56df6b8c65acade9c48f92820dc2389.mp4

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have to guess but it looks like it is choosing the same spawner when you pick a random instance before it is destroyed. Add logging with the Browser object and record the spawner.UID to see if it is the same one being picked each time when this happens. Also the instance variables on the Dummy object could just be global variables from what I can tell.

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