Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | The Asker |
I have a Control Node and under it there is a textureProgress. I did a function in where i change the value. After it i print() it. In another class i called the function. The output says the right value but the progressBar does not update. So it is always saying 100%
code of the function:
onready var bar2 = $HealthBar2
func _setDamage(damage):
bar2.value -= damage
print(bar2.value)
code of the call in the other class:
$HealthBar._setDamage(40)
If i change the value with a button which is in the same scene it works. But if i call the _on_Button_pressed() function on the other script it does not work!
Are you trying to update HealthBar or HealthBar2? Because your code only updates HealthBar2.
exuin | 2021-03-12 02:44
I am aware that only the second health bar should change here, but neither of them is changing
The Asker | 2021-03-12 12:16
Can you post your node hierarchy?
exuin | 2021-03-12 15:13
I dont know how to delete the question but i found a solution…
The Asker | 2021-03-13 01:15
You can still hide the question.
exuin | 2021-03-13 01:36