refactor map
This commit is contained in:
+5
-5
@@ -68,14 +68,14 @@ acquire_enemy :: proc(world: ^World) -> ^Enemy {
|
||||
}
|
||||
|
||||
spawn_enemy :: proc(world: ^World, kind: Enemy_Kind) {
|
||||
if len(world.path) == 0 do return // don't spawn enemies if no paths exist
|
||||
if len(world.world_map.path) == 0 do return // don't spawn enemies if no paths exist
|
||||
|
||||
e := acquire_enemy(world) // grab a free slot
|
||||
if e == nil do return // if there are no slots, skil spawning
|
||||
|
||||
arch := get_enemy_archetype(kind, world.wave.current_wave)
|
||||
e^ = Enemy {
|
||||
position = world.path[0],
|
||||
position = world.world_map.path[0],
|
||||
health = arch.health,
|
||||
max_health = arch.health,
|
||||
base_speed = arch.speed,
|
||||
@@ -87,19 +87,19 @@ spawn_enemy :: proc(world: ^World, kind: Enemy_Kind) {
|
||||
}
|
||||
|
||||
update_enemies :: proc(world: ^World, dt: f32) {
|
||||
if len(world.path) < 2 do return
|
||||
if len(world.world_map.path) < 2 do return
|
||||
|
||||
for i in 0 ..< MAX_ENEMIES {
|
||||
e := &world.combat.enemies[i]
|
||||
if !e.active do continue
|
||||
|
||||
if e.path_index >= len(world.path) {
|
||||
if e.path_index >= len(world.world_map.path) {
|
||||
world.base_health -= 1
|
||||
e.active = false
|
||||
continue
|
||||
}
|
||||
|
||||
target := world.path[e.path_index]
|
||||
target := world.world_map.path[e.path_index]
|
||||
move_speed := e.base_speed
|
||||
if e.slow_timer > 0 {
|
||||
move_speed *= ICE_SLOW_FACTOR
|
||||
|
||||
Reference in New Issue
Block a user