Godot Version
<stable4.2>
Question
<Im using two texture progress bar to make my boss health bar. one for front bar, and other one for background bar to smoothly decrease. Im using tween for background bar to do that and works perfectly except, when the health is zero, the background bar does not go zero. any idea why?
func take_damage(amount: int) -> void:
print("take damage")
print("DMG:", amount)
health_barfront.value = health
var value = health_barback.value
value = health
var tween = create_tween()
tween.tween_property($"../BossHealthBar/BarFrame/TextureProgressBar2", "value", value, 0.5).set_trans(Tween.TRANS_SINE)
health = max(0, health - amount)
if health == 0:
health_barfront.value = 0
health_barback.value = 0
change_state(States.DEATH)