I want to flip the enemy NPC toward the player’s direction when the enemy is injure using the health extension, but I’m not sure how to make it work. Does this require me to use variable?
You can use an strucdture variable in your enemy object like this
So store into that variables the enemy state hp, isAlive, isHurt, etc, when the enemy is in collision with your player bullet or sword then set enemy.Variable(Wolf.IsHurt) to true and check
if enemy.Variable(Wolf.IsHurt) == true do your stuff.
What about the flip part?
Well if you add an enemy variable to be changed like is hurt then you compare
if enemy ishurt == true
Compare two strings (enemy.X() < Player.X()) flip enemy yes
Compare two strings (enemy.X() > Player.X()) flip enemy no