blob: 9b2e4b1be03304f7dfc3615c99cb448df79dea8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 _input(event):
if event.is_action_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")
|