Commented Notice_message.gd script
This commit is contained in:
parent
3c3aa5113d
commit
a7b1a69c28
@ -1,19 +1,31 @@
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user