summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Objects/BuilderObject.gd23
-rw-r--r--Objects/BuilderObject.tscn2
2 files changed, 11 insertions, 14 deletions
diff --git a/Objects/BuilderObject.gd b/Objects/BuilderObject.gd
index 9131120..04ff0b8 100644
--- a/Objects/BuilderObject.gd
+++ b/Objects/BuilderObject.gd
@@ -2,8 +2,6 @@ class_name BuilderObject
extends Node2D
-signal collided
-
var is_colliding = false
var is_dragged = false
@@ -12,18 +10,8 @@ var last_position = Vector2(0,0)
func _process(_delta):
- if $Area2D.get_overlapping_areas().size() > 0:
- is_colliding = true
- else:
- is_colliding = false
-
if is_dragged:
position = get_global_mouse_position() + mouse_offset
-
- if is_colliding:
- modulate = Color("bb5a4b")
- else:
- modulate = Color("fff")
func _on_area_2d_input_event(_viewport, event: InputEvent, _shape_idx):
@@ -48,3 +36,14 @@ func drag_end():
queue_free()
is_dragged = false
+
+
+func _on_area_2d_area_entered(_area):
+ is_colliding = true
+ modulate = Color("bb5a4b")
+
+
+func _on_area_2d_area_exited(_area):
+ if $Area2D.get_overlapping_areas().size() == 0:
+ is_colliding = false
+ modulate = Color("fff")
diff --git a/Objects/BuilderObject.tscn b/Objects/BuilderObject.tscn
index ad83377..aae66c7 100644
--- a/Objects/BuilderObject.tscn
+++ b/Objects/BuilderObject.tscn
@@ -23,6 +23,4 @@ region_rect = Rect2(2, 13, 60, 49)
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]
-[connection signal="area_shape_entered" from="Area2D" to="." method="_on_area_2d_area_shape_entered"]
-[connection signal="area_shape_exited" from="Area2D" to="." method="_on_area_2d_area_shape_exited"]
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]