1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-25 09:34:24 +00:00

Create Collectible behaviour based on @snowycoder's Gold entity

This commit is contained in:
Steffo 2024-04-13 23:27:36 +02:00
parent 9550f690dc
commit c0055761a4
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 29 additions and 0 deletions

15
behaviours/collectable.gd Normal file
View file

@ -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)

View file

@ -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")