# How do I make a time based spawner?

Get help using Construct 2

### » Thu Mar 20, 2014 1:53 pm

Hello everyone,

Got a bit of an issue. I'm trying to make a risk of rain kind of game. In Risk of Rain enemies spawn randomly across your screen but as the game progresses the amount of enemies spawned increases and seems to have a cap on the spawn speed so as not to make your game go haywire with 9000 enemies being spawned after an hour of play.

So I have a spawner invisible block and the enemy it's trying to spawn but I don't know how to make it spawn time based with a cap on it.

I hope my question is clear but if not then ask away.
B
3
S
1
Posts: 3
Reputation: 335

### » Thu Mar 20, 2014 2:06 pm

I would suggest a conditional spawn.

1st Condition: #of active enemies < 9000
2nd Condition: your timer = specific Time
Action: Create Enemy
B
44
S
10
G
8
Posts: 437
Reputation: 6,483

### » Thu Mar 20, 2014 4:31 pm

Well, I'm pretty new to construct 2 still so your instructions are a bit hard for me to follow.

I can't find the first condition in construct 2. I reckon it's using the system condition but I can't find it.
The second part about the timer is the most confusing and what troubles me, I can't work it out.

The screenshot I've added shows what I have at the moment but the speed at which it spawns will at some point reach an impossible speed and the game starts lagging..

If it's not enough information I'll add the .capx.

Anyway thanks for commenting
You do not have the required permissions to view the files attached to this post.
B
3
S
1
Posts: 3
Reputation: 335

### » Thu Mar 20, 2014 4:44 pm

To limit the speed you can use the max() function.

max(5 - (time * 0.01), 2)
So now the minimum time is 2 seconds

The condition @Ubivis is talking about is "Compare two values", a system condition
Then on one box you put enemies.count (click the enemy object > count) and on the other the max number of enemies
B
86
S
22
G
15
Posts: 1,039
Reputation: 15,314

### » Thu Mar 20, 2014 6:36 pm

Thank you very much, this is exactly what I wanted
B
3
S
1
Posts: 3
Reputation: 335