I wanted to put an enemy's HP bar on screen as part of my final project. Should I update it once per while loop like in the dragon game or should I only update it at certain times? I'm comparing it to the health feature from the dragon game, but I'm not sure how actually similar it is.
I'd guess you'd want to update it every time the enemy's health would change (every time you hit it/if it heals). From the dragon game, I've noticed that the fewer times you call functions, the less laggy your program will be.
I would recommend it gets updated every time the users HP either decreases or increases so it updates every time there is a change to the health.
I would suggest every time the item got hit or you got hit, then it call back because if try to check it every second might make the program laggy