commands, towers, etc
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package game
|
||||
|
||||
Tower :: struct {
|
||||
position: Vec2,
|
||||
}
|
||||
|
||||
try_place_tower :: proc(world: ^World, gx, gy: int) -> bool {
|
||||
if !can_build_at(&world.world_map, gx, gy) do return false
|
||||
if world.gold < TOWER_COST do return false
|
||||
|
||||
pos := grid_to_center(gx, gy)
|
||||
for t in world.towers {
|
||||
if distance(t.position, pos) < 1 do return false
|
||||
}
|
||||
|
||||
world.gold -= TOWER_COST
|
||||
append(&world.towers, Tower{position = pos})
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user