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