Player Health

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ThreeSpark

I am trying to get my player’s health to go down when a slime touches it. I already have the code for that, and I am trying to get a label to display the health variable, but it won’t change. Any suggestions? Here is the line of code that should change the text:

$Node2D/HPValue.text = str(health)
:bust_in_silhouette: Reply From: Diet Estus

Make sure you are calling this line of code in _process() or _fixed_process() or _physics_process() so that it is updated every frame. Just calling it in _ready() will only call it once when the parent node is added to the scene.

It is in _process(delta)

ThreeSpark | 2018-08-02 14:47