forked from kanium/starcheese
12 lines
354 B
GDScript3
12 lines
354 B
GDScript3
|
|
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
|