1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-25 00:54:19 +00:00
swear-jar/collector/collectible.gd

23 lines
610 B
GDScript3
Raw Normal View History

2023-10-01 01:03:03 +00:00
extends Node
class_name Collectible
2023-10-01 01:20:47 +00:00
## A marker for collectible entities.
##
## Used by [Collector]s to determine which entities to pick up.
2023-10-01 01:03:03 +00:00
2023-10-01 01:20:47 +00:00
## The type of collectible entity the parent entity represents.
@export var type: StringName
2023-10-01 01:03:03 +00:00
2023-10-01 01:20:47 +00:00
## Emitted when this entity has been collected by a collector.
2023-10-01 01:03:03 +00:00
signal collected
2023-10-01 01:20:47 +00:00
## Mark this entity as collected.
##
## You'll probably want to connect this to an AudioSource2D, which will disable the node and play a sound, and when the sound is over a new signal will queue_free it.
2023-10-01 01:03:03 +00:00
func collect():
emit_signal("collected")
2023-10-02 03:31:31 +00:00
func _on_done():
get_parent().queue_free()