Add different enemy types (Runner)
This commit is contained in:
+5
-1
@@ -11,6 +11,7 @@ Wave_Spawner :: struct {
|
||||
enemies_to_spawn: int,
|
||||
spawn_timer: f32,
|
||||
spawn_interval: f32,
|
||||
spawn_count: int,
|
||||
}
|
||||
|
||||
start_wave :: proc(world: ^World) {
|
||||
@@ -30,10 +31,13 @@ update_wave :: proc(world: ^World, dt: f32) {
|
||||
if len(world.path) < 2 do return
|
||||
|
||||
world.spawner.spawn_timer -= dt
|
||||
kind := Enemy_Kind.Grunt
|
||||
if world.spawner.spawn_count % 3 == 2 do kind = .Runner
|
||||
if world.spawner.spawn_timer <= 0 {
|
||||
health := 15 + world.wave * 5
|
||||
speed := 55 + f32(world.wave) * 5
|
||||
spawn_enemy(world, health, speed)
|
||||
spawn_enemy(world, kind)
|
||||
world.spawner.spawn_count += 1
|
||||
world.spawner.enemies_to_spawn -= 1
|
||||
world.spawner.spawn_timer = world.spawner.spawn_interval
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user