Fixing Player Health Bar
Xodius Studios Blog #3
Fixing Player Health Bar
Author:Justin Palmer
Published: 03/03/2023 20:45
The Problem:
The main problem this week for me was getting the player health to work correctly. The player was getting hurt whenever he got close to an enemy. He would repeatedly get hurt every time the player approached or got close to an enemy. This would cause the player to die extremely fast and uncontrollably. This was a big issue that effects a players immersion and ability/want to play.
Problem Solution:
After doing a lot of debugging of the code, I noticed the damage occurred about the same time the player was entering the 'visual sphere' of the enemy. If the player kept going in and out of the sphere it would hurt the player each time. I eventually found I could just add a new check on the 'hurt player' blueprint to make the 'component overlap' check only remove damage if the 'enemy hitbox' is touching the player (the collider on the enemies hands), instead of ANY component attached to the enemy actor. Now the health drops only when attacked by the enemy, allowing the game to be more playable, fun and predictable!
Comments
Post a Comment