21 lines
422 B
GDScript

extends TextureProgressBar
@export var high: Texture2D
@export var medium: Texture2D
@export var low: Texture2D
var health: HealthComponent
func _ready():
health = owner.health
health.value_changed.connect(on_health_changed)
func on_health_changed():
value = health.value / health.max_value
if value < 0.45:
texture_progress = low
elif value < 0.75:
texture_progress = medium
else:
texture_progress = high