make random spawners stop

0 favourites
  • 7 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • I am trying to make it so random spawn enemies stop after x seconds or after x kills and make a boss spawn after they stop. What are some ways to do this? Here is my event sheet pic


  • Add a global variable, call it whatever you want. In your event, add the action "Add 1 to variable" and a condition too "If variable < 20"

    So, after you spawn 20 enemies, it will stop spawning, unless you set the variable to a number below 20 again

  • You might try making a variable that gets 1 added to it every time an enemy spawns.

    ex: variable name: numberEnemiesSpawned=0 (at the beginning if no enemies are present. Replace 0 with the number of enemies to be spawned/killed initially).

    and variable name: numberEnemiesToBoss= 3 (this means that you want it to be 3 enemies spawned/killed until the boss appears)

    then you can make a condition:

    system - compare two variables

    first value - numberEnemiesSpawned

    comparison - =

    second value- numberEnemiesToBoss

    with the action of

    sprite - is visible (or however you want to spawn your boss)

    the above will make it so that the game checks to see if numberEnemiesSpawned and numberEnemiesToBoss are equal.

    then you make conditions such that every time an enemy dies, it adds +1 to numberEnemiesSpawned. It should add +1 up until 3 (starting from 0, not one, or else it will only be two baddies who are destroyed before the boss!).

    finally make a condition such that when numberEnemiesToBoss = 3 the boss spawns.

    Hope it helps! Let me know if anything is unclear!This worked for me but my game is different from yours :)

    NB. When I did it they were global variables. I don't have enough experience to know if instance variables will do!

  • thanks that works but now I have another problem when I spawn the boss it comes out as a blob not as it is supposed to. here's my capx can anyone tell me what i'm doing wrong?

  • It's because you are creating the boss every tick, so this means a boss is spawned 60 times each second

    Add an "Trigger once while true" condition there

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • about spawning by random i think you should use local variable with the number of enemies and it keep subtract 1 from variable when they spawn and when it zero the boss will spawn in this way you can edit the number of enemies very fast. so evey level you can just change that local variable from 40 to 60 for example and so on...

  • Thank you for your help everyone it worked! You guys rock.

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