Files
net-gunner/scripts/healthbar.gd

20 lines
617 B
GDScript

class_name HealthBar extends TextureProgressBar
@export var healthy_gradient : GradientTexture1D
@export var poisoned_gradient : GradientTexture1D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_health_changed(current : int, max : int) -> void:
max_value = max
value = current
func _on_poison_status_changed(poisoned : bool) -> void:
texture_progress = poisoned_gradient if poisoned else healthy_gradient