diff --git a/behaviours/collectable.gd b/behaviours/collectable.gd new file mode 100644 index 0000000..ec79ced --- /dev/null +++ b/behaviours/collectable.gd @@ -0,0 +1,15 @@ +extends Node2D +class_name Collectable + + +@export var tag: StringName + + +signal collected(tag: StringName) + + +func _on_mouse_area_mouse_entered() -> void: + collected.emit() + +func _on_collected(t: StringName) -> void: + Log.p(self, "Collected: %s" % t) diff --git a/behaviours/collectable.tscn b/behaviours/collectable.tscn new file mode 100644 index 0000000..9b2a0ea --- /dev/null +++ b/behaviours/collectable.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://dj72yshd25ucx"] + +[ext_resource type="Script" path="res://behaviours/collectable.gd" id="1_p0pc3"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_su28r"] +radius = 16.4012 + +[node name="Collectable" type="Node2D"] +script = ExtResource("1_p0pc3") + +[node name="CollectArea" type="Area2D" parent="."] + +[node name="Shape" type="CollisionShape2D" parent="CollectArea"] +shape = SubResource("CircleShape2D_su28r")