road-rage-tank/player/health_bar.gd

16 lines
324 B
GDScript

extends Control
func _ready() -> void:
get_parent().modulate.a = 0.
func update(value: int) -> void:
if value == 3: return
get_parent().modulate.a = 1.
for child in get_children():
child.visible = value > 0
value -= 1
create_tween() \
.tween_property(get_parent(), "modulate:a", 0., 1.) \
.set_delay(2.)