How do I make my enemies respawn without breaking the game?

  • The way I have my enemies spawn is I add a spawn object that creates an enemy and destroys the spawner when you're within range of it. It allows me to have many enemies in the "level" without the pathfinding and other things destroying the frame rate. How do I make it so that when I'm not in the area for a certain time (3-5 minutes) it respawns the spawning, while preventing it from eventually spawning thousands of enemies. Sorry for the terrible explanation, It's hard to describe how it's set up.

  • Use System Condition to test how many enemy objects are there.

    From https://www.scirra.com/manual/124/system-conditions

    [quote:28lwcnep]

    Compare two values

    Compare any two expressions (which can either numbers or text) with each other. They can be compared as Equal, Not equal, Less, Less or equal,Greater or Greater or equal.

    Assuming EnemySprite is your enemy's sprite's name, you could refer to the Count variable of the EnemySprite.

    For example, with the above system condition, you could put EnemySprite.Count in first expression and the number 100 in the second expression. Then, compare these two expressions as "< less than".

    This means, whenever EnemySprite object is less than 100, the condition will be true. You could add your action to spawn more enemies in this condition here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use System Condition to test how many enemy objects are there.

    From

    [quote:334s1cgo]

    Compare two values

    Compare any two expressions (which can either numbers or text) with each other. They can be compared as Equal, Not equal, Less, Less or equal,Greater or Greater or equal.

    Assuming EnemySprite is your enemy's sprite's name, you could refer to the Count variable of the EnemySprite.

    For example, with the above system condition, you could put EnemySprite.Count in first expression and the number 100 in the second expression. Then, compare these two expressions as "< less than".

    This means, whenever EnemySprite object is less than 100, the condition will be true. You could add your action to spawn more enemies in this condition here.

    This doesn't seem to work, it will just spawn the 100 enemies in the first "spawner" object i meet. When i add a timer condition for every 60 seconds or more it just crashes the game.

  • Then you are doing it wrong in the event sheet. Screencap your event sheet and post it here.

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