For this update, I worked on making a telegraphed attack to give the player a prompt to dodge and worked on collisions for enemy attacks.
Enemy


I’ve changed the “SpawnPunch” function to start a timer that executes “ThrowPunch” after 2 seconds.

Player Header File

For ease of use later on, I’ve allowed the collision profile of the characters static mesh to be changed in the derived blueprint. In this prototype the enemy arm will overlap with the player to damage them, but in the future it may need to be blocked by the player.
Player CPP File

Originally I: attached the “Body” to the root component, transformed and set the static mesh in the initializer; however I discovered these only work in runtime. Therefore, I changed my code so it would set the model in the initializer and setup the other “Body” aspects in “BeginPlay”.


This code also assigns the collision profile name. Initially I had this segment in the initializer, however since the name is set in a blueprint adapted from the C++ code it can only be set during runtime.

Here if the enemy hits the player, it’ll reduce their health and output what their health is after the attack.
Punch Task


Previously, I had the “DestroyPunch” and “SetActorLocation” functions swapped around. However, this meant the player could still be hit after the enemy retreated, so I rearranged the order for consistency.