How can i make a floating health bar on enemy?
i'm new to the engine and i'm trying to learn by making a little 2d Side-Scrolling game. I wonder how to make a health bar for the enemy that floats above it, bind it to his health and only appear when damaged. i found that with widget component you can do that, but can't find how.
asked Mar 24 '17 at 06:43 PM in Using UE4
Solution using WidgetComponent:
Here is the way i always do it:
BONUS: to make sure the progress bar is always facing player, in the enemy character add a function called "rotateHealthbarToPlayer" in it, do the following:
Call this function from Event Tick.
To sum up: Enemy character loses health. It updates widget to display it in progress bar (which is in a value of 0 to 1). Widget will rotate towards player each tick.
If i missed something, let me know. Tried to be as specific as possible.
All the best :)
THANK YOU for CopperStoneSea for finding a mistake in step 10
You will need to bind your progress bar to the health of your character in the widget blueprint. I hope this helps.
answered Mar 25 '17 at 11:38 AM
There is a small tutorial in the docs. Maybe this will help you: https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/index.html
answered Mar 26 '17 at 03:55 PM
Hello everyone. i followed this guide and although the health bar rotation works like a charm, i cant figure out how to apply damage and affect the health bar. if anyone has got it right and can help with the blueprints that would be great.
answered Jul 04 '18 at 10:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here