tower ugprades

This commit is contained in:
2026-06-25 20:28:55 -07:00
parent d6ee5abb01
commit 4d267c7f5d
2 changed files with 84 additions and 17 deletions
+9
View File
@@ -6,6 +6,7 @@ Command_Kind :: enum {
None,
Place_Tower,
Start_Wave,
Upgrade_Tower,
}
Command :: struct {
@@ -25,6 +26,12 @@ gather_commands :: proc(world: ^World) -> Command {
return Command{kind = .Start_Wave}
}
if rl.IsMouseButtonPressed(.RIGHT) {
mouse := game_mouse()
gx, gy := screen_to_grid(mouse.x, mouse.y)
return Command{kind = .Upgrade_Tower, gx = gx, gy = gy}
}
if world.phase == .Build && rl.IsMouseButtonPressed(.LEFT) {
mouse := game_mouse()
gx, gy := screen_to_grid(mouse.x, mouse.y)
@@ -41,6 +48,8 @@ execute_command :: proc(world: ^World, cmd: Command) {
try_place_tower(world, cmd.gx, cmd.gy, world.selected_tower)
case .Start_Wave:
start_wave(world)
case .Upgrade_Tower:
try_upgrade_tower(world, cmd.gx, cmd.gy)
}
}