Launcher/Notice_msg.gd

32 lines
816 B
GDScript

extends Node2D
# Define variables (These will be overriden by another script)
var message
var type
# When everything is loaded,
func _ready():
# If the type is "warning",
if type == "warning":
# Add a yellow color override
$Label.add_color_override("font_color", Color(255, 69, 0))
# If the type is "alert",
if type == "alert":
# Add a red color override
$Label.add_color_override("font_color", Color(255, 0, 0))
# Every process tick
func _process(_delta):
# Set the Label's text to the given message
$Label.text = message
# When the TTL timer time's out,
func _on_TTL_timeout():
# Start the move_off_screen animation
$AnimationPlayer.play("move_off_screen")
# When animation finishes,
func _on_AnimationPlayer_animation_finished(_anim_name):
# Queue_free (AKA, delete) this node
queue_free()