spawns all entities
connected chests to color/ui
This commit is contained in:
@@ -1 +1,20 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user