I have been trying to code the TextureProgress into a health bar, but it is not working. The value will not decrease when my character comes into contact with the enemy. $HealthBar is the textureprogress. I have coded the decrease in value in the enemy script as:
func _on_Area2D_body_entered(body): #connected signal
if body.get_name() == "Character":
body.respawn()
$HealthBar.value(-15)
value keeps returning as a null instance
and the health bar code is:
onready var health_bar = $HealthBar
func _on_health_updated(health, amount):
health_bar.value = health
func _on_max_health_updated(max_health):
health_bar.max_value = max_health