extends Node2D

@export var item: InvItem

@onready var player = get_tree().get_first_node_in_group("Player")

func _ready() -> void:
	%TextureRect.texture = item.texture

func _on_area_2d_area_entered(area: Area2D) -> void:
	if area.get_parent() == player:
		player.collect(item)
		call_deferred("queue_free")


func _on_despawn_timer_timeout() -> void:
	call_deferred("queue_free")
