starcheese/collectible.gd

12 lines
354 B
GDScript3
Raw Normal View History

2025-01-04 02:25:39 +01:00
class_name Collectible
extends Area2D
@export var item_type: String = "default_item"
@export var value: int = 1
signal collected(item_type: String, value: int, collector: Node, collectible: Node)
func _on_body_entered(body):
if body.is_in_group("spaceships"):
emit_signal("collected", item_type, value, body, self) # Include a reference to itself