0 Favourites

Random spawn objects

  • So, I've seen a few posts touch upon random spawning but it wasn't quite what I was looking for.

    I'm making a top down shooter (think 1943) and upon an enemy being destroyed I want them to randomly spawn either a power up, health, or nothing. Ideally (if it's not too crazy) I'd like to have control over, say, the likelihood of power ups that are spawned per level. I've gotten to the point where I can make the spawns seem random - but I know they're not and it bothers the crap out of me. I also fee like I'm taking the long road to get there by doing instance variables on each enemy that tick up every time the enemy is destroyed. When the count = 4, spawn object, etc. There has to be an easier way!

    Any help is appreciated.

  • Have you looked at using families? So into the family you could add all the things you wanted to spawn and then spawn family would pick one of them randomly.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Have you looked at using families? So into the family you could add all the things you wanted to spawn and then spawn family would pick one of them randomly.

    We can't use families without the personal edition

  • laypax

    Without families you'll have to be much more verbose with your events. Like for instance setting a variable to a random integer (ex: int(random(5))) and then check it's value. For ex: if var=0 then create health, if var=1 then create powerup, ... etc

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