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

Get help using Construct 2

Post » Sun Feb 08, 2015 1:55 am

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.
B
9
S
5
Posts: 40
Reputation: 919

Post » Sun Feb 08, 2015 8:36 am

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

From https://www.scirra.com/manual/124/system-conditions
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.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Sun Feb 08, 2015 9:43 pm

Message: thedude1693 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
keroberos wrote:Use System Condition to test how many enemy objects are there.

From
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.
B
9
S
5
Posts: 40
Reputation: 919

Post » Mon Feb 09, 2015 4:04 am

Then you are doing it wrong in the event sheet. Screencap your event sheet and post it here.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 6 guests