25 lines
1.0 KiB
GDScript
25 lines
1.0 KiB
GDScript
extends Label
|
|
|
|
const DISPLAY_DURATION := 1.3
|
|
|
|
@export var text_color := Color(1.0, 0.78, 0.28, 1.0)
|
|
@export var is_critical := false
|
|
@export var is_evade := false
|
|
|
|
func _ready() -> void:
|
|
z_index = 30
|
|
add_theme_color_override("font_color", Color("ff8b64") if is_critical else text_color)
|
|
add_theme_color_override("font_shadow_color", Color(0.05, 0.08, 0.12, 0.95))
|
|
add_theme_constant_override("shadow_offset_x", 2)
|
|
add_theme_constant_override("shadow_offset_y", 2)
|
|
add_theme_font_size_override("font_size", 28 if is_critical else (24 if is_evade else 19))
|
|
if is_critical or is_evade:
|
|
scale = Vector2.ONE * 1.2
|
|
create_tween().tween_property(self, "scale", Vector2.ONE, 0.18).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
|
|
var tween := create_tween()
|
|
tween.set_parallel(true)
|
|
tween.tween_property(self, "position:y", position.y - 48.0, DISPLAY_DURATION).set_ease(Tween.EASE_OUT)
|
|
tween.tween_property(self, "modulate:a", 0.0, DISPLAY_DURATION).set_ease(Tween.EASE_IN)
|
|
tween.set_parallel(false)
|
|
tween.tween_callback(queue_free)
|