Combat system (Part 1) attack anim

Combat (Part 3) Player & Enemy damage



Apply Enemy damage to player:


Open Enemy AI BP ,created in
image.png

In viewport, add arrow component, place at follow:
image.png
Modify Follow player custom node (after Play anim montage),
Promote variable (Object type) in sphere overlap actor, set Pawn in default value
image.png

Now enemy will apply damage to everything. To make it only valid to player, set Tag:

Go to 3rd person BP, add tag name as Player
image.png
Back to Enemy BP, add graph as below:
image.png


Apply Player damage to Enemy:


Go to Enemy BP
create float health variable (if not yet made)
image.png

Open a Widget for Enemy (scale down the frame just cover the bar), make the bar and create bind
image.png
image.png
image.png
Go to Enemy BP viewport, add widget component
Choose Widget Class, then put the health progress bar upward
image.png

To make the health bar always face to the camera:
In Enemy BP graph, event tick, add sequence:
image.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.