Files
rgb/scripts/chest.gd
Eric 6f1d578ee1 spawns all entities
connected chests to color/ui
2024-02-12 08:08:35 -06:00

21 lines
452 B
GDScript

extends StaticBody2D
class_name Chest
@export var buff: Buff
const CHEST_OPENED = preload("res://assets/chest_opened.png")
var recipients = []
var opened := false
func open(entity) -> Buff:
if not recipients.has(entity):
if not opened:
opened = true
$Sprite2D.texture = CHEST_OPENED
var buff_texture := Sprite2D.new()
buff_texture.texture = buff.image
add_child(buff_texture)
recipients.append(entity)
return buff
return null