Player Health System (Unreal Engine 5)

 As part of a game jam, I created a simple health system.

I began with a simple AnyDamage event. I created a variable for Player Health. Then I made sure to subtract the damage from the Player Health (Which was set at 100). Then for testing purposes, I added a print screen read out that checked if the Player Health was at 0. If it was the Print would read "Dead". Another print out displayed the current Player Health.


To test this I created an event that indicated when the J key was pressed, Player Health received 10 points of damage. This would then be reflected in the print screen readout for current Player Health.


Next, I created a simple widget, which was a progress bar and set the colour to red to reflect health. 


Then in the Player blueprint, I ensured that when the game began The health bar is displayed to the viewport so the player can see it in-game. 

Finally, I edited the progress bar event graph to ensure it updated as the player health dropped when the J key was pressed.


And the final result in video shows the health bar decrease as J is pressed and the printouts reflect the changes and eventually, character death.



Comments

Popular posts from this blog

Creating a simple dialogue system in Unreal Engine 5

Remaking Mario in Unreal Engine 5 (Part 2)

Remaking Mario in Unreal Engine 5 (Part 1)