diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-04-14 21:49:20 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-04-14 21:49:20 +0200 |
commit | f27937e6e9b6a7146dd09fc711d2d293ecf5abbf (patch) | |
tree | e0ddd5e6d356000e4f29af6211a736284a4972ee /Scenes/Entities/Objects/Sign.gd | |
parent | 96d36cee33d6321834565f0a5d412ef95c5ceffd (diff) |
update
Diffstat (limited to 'Scenes/Entities/Objects/Sign.gd')
-rw-r--r-- | Scenes/Entities/Objects/Sign.gd | 20 |
1 files changed, 20 insertions, 0 deletions
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") |