move path length check to outside the loop
This commit is contained in:
+2
-2
@@ -87,12 +87,12 @@ spawn_enemy :: proc(world: ^World, kind: Enemy_Kind) {
|
||||
}
|
||||
|
||||
update_enemies :: proc(world: ^World, dt: f32) {
|
||||
if len(world.path) < 2 do return
|
||||
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
e := &world.enemies[i]
|
||||
if !e.active do continue
|
||||
|
||||
if len(world.path) < 2 do return
|
||||
|
||||
if e.path_index >= len(world.path) {
|
||||
world.base_health -= 1
|
||||
e.active = false
|
||||
|
||||
Reference in New Issue
Block a user