Files
imnotsick/Scenes/UI/game_over_control.gd
T
2026-06-11 21:33:17 +02:00

36 lines
945 B
GDScript

extends Control
@onready var background = $Background
@onready var back_to_menu = $UI/HBoxContainer/BackToMainMenu
@onready var reload_checkpoint = $UI/HBoxContainer/ReloadCheckpoint
@onready var message = $UI/Message
@onready var animation_player = $AnimationPlayer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Resets to initial state
reset()
#Reveals the game over screen
func reveal(message_text: String):
#Reveals the background image first
show()
background.show()
background.reveal_spray()
await background.reveal_done
#Reveals the text and buttons afterwards
message.text = Globals.colorize(message_text, "dark_red")
for node in [message, back_to_menu, reload_checkpoint]:
node.modulate.a = 0.0
node.show()
animation_player.play("fade_in")
#Resets to initial state
func reset():
for node in [background, back_to_menu, reload_checkpoint, message]:
node.hide()
hide()