From 15a1d2a66e48324e1d560dc13b776627820f3999 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 27 Oct 2024 15:52:48 +0100 Subject: next commit --- Game/States/Build/BuilderElement.gd | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'Game/States') diff --git a/Game/States/Build/BuilderElement.gd b/Game/States/Build/BuilderElement.gd index 38417ff..8c98bdc 100644 --- a/Game/States/Build/BuilderElement.gd +++ b/Game/States/Build/BuilderElement.gd @@ -21,12 +21,13 @@ func _ready(): $Sprite2D.region_rect = element_sprite.region_rect $Sprite2D.scale = element_sprite.scale $Sprite2D.position = element_sprite.position + $Sprite2D.scale = instance.scale var element_collision_shape = instance.get_node("CollisionShape2D").duplicate() as CollisionShape2D collision_shape = element_collision_shape.shape var tile_size = Client.current_stage.map.tile_set.tile_size - var snapped_size = collision_shape.size.snapped(tile_size) + var snapped_size = (collision_shape.size * instance.scale).snapped(tile_size) for x in (snapped_size.x / tile_size.x): for y in (snapped_size.y / tile_size.y): var collision_visibility_area_scene = preload("res://UI/CollisionVisibilityArea.tscn") @@ -60,22 +61,12 @@ func _ready(): collision_areas.append(collision_visibility_area) -func _draw(): - draw_circle( - Client.current_stage.map.tile_set.tile_size, - 8 + instance.attack_range, - Color(1, 1, 1, 0.75), - false, - 1.0 - ) - - func _process(_delta): previous_position = global_position - global_position = get_global_mouse_position().snapped(Client.current_stage.map.tile_set.tile_size) - Vector2(16,16) - - if global_position != previous_position: - queue_redraw() + global_position = ( + get_global_mouse_position().snapped(Client.current_stage.map.tile_set.tile_size) + - Vector2(Client.current_stage.map.tile_set.tile_size) + ) # TODO: rpc to other peers # TODO: only as preview not as blocking to build @@ -93,10 +84,3 @@ func can_build(): #return Client.current_stage.can_build() return true - - -func _on_area_entered(_node) -> void: - queue_redraw() - -func _on_area_exited(_node) -> void: - queue_redraw() -- cgit v1.2.3