summaryrefslogtreecommitdiff
path: root/Game/States
diff options
context:
space:
mode:
Diffstat (limited to 'Game/States')
-rw-r--r--Game/States/Build/BuilderElement.gd5
-rw-r--r--Game/States/Build/build_grid.gd21
2 files changed, 17 insertions, 9 deletions
diff --git a/Game/States/Build/BuilderElement.gd b/Game/States/Build/BuilderElement.gd
index eb5ae12..38417ff 100644
--- a/Game/States/Build/BuilderElement.gd
+++ b/Game/States/Build/BuilderElement.gd
@@ -88,10 +88,9 @@ func can_build():
if area.get_overlapping_bodies().size() > 0:
return false
-
- if Client.current_stage.has_method("can_build"):
- return Client.current_stage.can_build()
+ #if Client.current_stage.has_method("can_build"):
+ #return Client.current_stage.can_build()
return true
diff --git a/Game/States/Build/build_grid.gd b/Game/States/Build/build_grid.gd
index 766c79b..67c962e 100644
--- a/Game/States/Build/build_grid.gd
+++ b/Game/States/Build/build_grid.gd
@@ -1,21 +1,30 @@
extends Node2D
+@onready var camera: Camera = get_viewport().get_camera_2d()
+
+
+func _ready() -> void:
+ camera.zoomed.connect(func(_zoom):
+ queue_redraw()
+ )
+
+
func _draw():
var area = Client.current_stage.map.get_used_rect()
var cell_size = Client.current_stage.map.tile_set.tile_size
var offset = area.position
for row in range(0, area.size.y + 1):
draw_line(
- Vector2(offset.x * cell_size.x, offset.y + row * cell_size.y),
- Vector2(offset.x * cell_size.x + area.size.x * cell_size.x, offset.y + row * cell_size.y),
+ Vector2(offset.x * cell_size.x, offset.y * cell_size.y + row * cell_size.y),
+ Vector2(offset.x * cell_size.x + area.size.x * cell_size.x, offset.y * cell_size.y + row * cell_size.y),
Color(1, 1, 1, 0.25),
- 1.0
+ 1.0 / camera.zoom.x
)
for column in range(0, area.size.x + 1):
draw_line(
- Vector2(offset.x * cell_size.x + column * cell_size.x, offset.y),
- Vector2(offset.x * cell_size.x + column * cell_size.x, offset.y + area.size.y * cell_size.y),
+ Vector2(offset.x * cell_size.x + column * cell_size.x, offset.y * cell_size.y),
+ Vector2(offset.x * cell_size.x + column * cell_size.x, offset.y * cell_size.y + area.size.y * cell_size.y),
Color(1, 1, 1, 0.25),
- 1.0
+ 1.0 / camera.zoom.x
)