You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
738 B
29 lines
738 B
extends Node2D
|
|
|
|
@onready var _damage_animation = $AnimationPlayer
|
|
@onready var _damage_label = $Label
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
visible = false
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(_delta):
|
|
pass
|
|
|
|
func show_damage(amount:int):
|
|
visible = true
|
|
_damage_label.visible = false
|
|
_damage_label.set_text("%d" % amount)
|
|
_damage_animation.play("Pop-Up", -1, 2.5)
|
|
|
|
func _on_animation_finished(anim_name):
|
|
if anim_name == "Pop-Up":
|
|
_damage_label.visible = true
|
|
_damage_animation.play("Show", -1, 2.0)
|
|
elif anim_name == "Show":
|
|
_damage_label.visible = false
|
|
_damage_animation.play("Fade-Out", -1, 2.5)
|
|
else:
|
|
visible = false
|