shoot projectiles

This commit is contained in:
2026-06-13 23:33:03 -07:00
parent 5f3ef33b05
commit b9235246c7
6 changed files with 123 additions and 26 deletions
+25 -12
View File
@@ -11,6 +11,22 @@ render_world :: proc(world: ^World) {
}
}
for t in world.towers {
rl.DrawRectangle(
i32(t.position.x - 14),
i32(t.position.y - 14),
28,
28,
rl.Color{255, 203, 0, 255},
)
}
for i in 0 ..< MAX_PROJECTILES {
p := world.projectiles[i]
if !p.active do continue
rl.DrawCircle(i32(p.position.x), i32(p.position.y), 4, rl.GOLD)
}
for i in 0 ..< MAX_ENEMIES {
e := world.enemies[i]
if !e.active do continue
@@ -24,18 +40,11 @@ render_world :: proc(world: ^World) {
)
}
for t in world.towers {
rl.DrawRectangle(
i32(t.position.x - 14),
i32(t.position.y - 14),
28,
28,
rl.Color{255, 203, 0, 255},
)
}
if (world.base_health == 0) {
rl.DrawText("**GAME OVER**", 20, 20, 20, rl.RED)
for i in 0 ..< MAX_PROJECTILES {
p := world.projectiles[i]
if !p.active do continue
rl.DrawCircle(i32(p.position.x), i32(p.position.y), 4, rl.GOLD)
}
rl.DrawText(fmt.ctprintf("Gold: %d", world.gold), 10, 10, 22, rl.BLACK) // Gold HUD
@@ -47,7 +56,11 @@ render_world :: proc(world: ^World) {
case .Build:
rl.DrawText("Build - click towers, N = start wave", 10, 98, 22, rl.BLACK)
case .Combat:
rl.DrawText("Combat!", 10, 74, 22, rl.MAROON)
rl.DrawText("Combat!", 10, 98, 22, rl.MAROON)
case .Game_Over:
rl.DrawText("GAME_OVER", 260, 280, 40, rl.RED)
case .Victory:
rl.DrawText("Victory!", 260, 280, 40, rl.GREEN)
}
}