move path length check to outside the loop

This commit is contained in:
2026-06-26 18:54:08 -07:00
parent 7e69113d37
commit 781e8653e7
+2 -2
View File
@@ -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