enemy movement and object pool

This commit is contained in:
2026-06-10 02:32:01 -07:00
parent 85f6a286ac
commit 2e09dbe65d
4 changed files with 81 additions and 22 deletions
+7 -2
View File
@@ -15,8 +15,9 @@ render_world :: proc(world: ^World) {
rl.DrawCircle(i32(p.x), i32(p.y), 3, rl.GOLD)
}
if world.enemy.active {
e := world.enemy
for i in 0 ..< MAX_ENEMIES {
e := world.enemies[i]
if !e.active do continue
rl.DrawCircle(i32(e.position.x), i32(e.position.y), 11, rl.MAROON)
rl.DrawText(
fmt.ctprintf("%d", e.health),
@@ -25,9 +26,13 @@ render_world :: proc(world: ^World) {
12,
rl.WHITE,
)
}
if (world.base_health == 0) {
rl.DrawText("**GAME OVER**", 20, 20, 20, rl.RED)
}
rl.DrawText(fmt.ctprintf("Gold: %d", world.gold), 10, 10, 20, rl.BLACK) // Gold HUD
rl.DrawText(fmt.ctprintf("Base HP: %d", world.base_health), 10, 32, 20, rl.BLACK) // HP HUD
rl.DrawText(fmt.ctprintf("Enemies: %d", active_enemy_count(world)), 10, 54, 18, rl.DARKGRAY)
}