From f27937e6e9b6a7146dd09fc711d2d293ecf5abbf Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 14 Apr 2024 21:49:20 +0200 Subject: update --- Scenes/Entities/Objects/Sign.gd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Scenes/Entities/Objects/Sign.gd (limited to 'Scenes/Entities/Objects/Sign.gd') diff --git a/Scenes/Entities/Objects/Sign.gd b/Scenes/Entities/Objects/Sign.gd new file mode 100644 index 0000000..9d83bab --- /dev/null +++ b/Scenes/Entities/Objects/Sign.gd @@ -0,0 +1,20 @@ +extends StaticBody2D + + +signal interacted + +var interaction_area: Area2D + + +func _ready(): + add_to_group("interactables") + + interaction_area = Utilities.Collision.Area.new(self, $CollisionShape2D) + add_child(interaction_area) + + +func _physics_process(_delta): + if Input.is_action_just_pressed("ui_accept") and interaction_area.has_overlapping_areas(): + for area in interaction_area.get_overlapping_areas(): + if area.is_in_group("player"): + emit_signal("interacted") -- cgit v1.2.3