tower ugprades
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user