extends Control
class_name GameOver

signal closed

@onready var animation: AnimationPlayer = $AnimationPlayer
@onready var message_label: Label = $MessageLabel

var message: String = "":
	set(new_value):
		message = new_value
		if message_label != null:
			message_label.text = new_value

func _ready() -> void:
	message_label.text = message
	animation.play("open")

func _on_close_button_pressed():
	animation.play("close")
	await animation.animation_finished
	closed.emit()
	queue_free()
