|Topic was automatically imported from the old Question2Answer platform.
Hello, I am very new to Godot and I am trying to make it so when my player’s health changes, it plays an animation. (for now im only worrying about any health change to play the animation).
My code is set so in my player script is a health variable
var playerHealth = 100
And in the enemy script is a code that shoots a raycast and if it collides with the player, it changes the playerHealth to mins the damage
var hit = rayCast.get_collider()
target.playerHealth -= damage
While I could use a get_node command to make it play the animation from within the enemy script. it seems more ideal to make it play for when the health changes in the player script. and from some reading it seems setget is the best way to do this, But I am unsure of how to utilise it correctly still after reading up on it