1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 16:14:22 +00:00
hella-farm/behaviours/collectable.gd

19 lines
375 B
GDScript3
Raw Normal View History

2024-04-15 20:58:18 +00:00
@icon("res://behaviours/collectable.svg")
2024-04-15 20:39:06 +00:00
extends Area2D
class_name Collectable
2024-04-15 20:39:06 +00:00
## Emits [signal collected] when the mouse enters the given [CollisionShape2D].
2024-04-15 20:39:06 +00:00
signal collected
2024-04-15 20:39:06 +00:00
@export var qty: int = 1
@export var tag: StringName = &""
2024-04-15 20:39:06 +00:00
func _on_mouse_entered() -> void:
2024-04-13 21:41:00 +00:00
collected.emit(tag)
2024-04-15 20:39:06 +00:00
func _on_collected() -> void:
Log.p(self, "Collected: %sx %s" % [qty, tag])