21 lines
422 B
GDScript3
Raw Normal View History

2024-02-12 23:22:27 +00:00
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)
2024-02-15 15:28:27 +00:00
2024-02-12 23:22:27 +00:00
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