Post 18: Attacks, Indicators and Kill Cam

Blockable and Unblockable Attacks

I wanted to lock down the fight sequences by improving how the player fought with the NPC’s. This involved implementing two types of attacks:

  1. A Blockable (Normal) attack
  2. An UnBlockable (Charged) attack

Having multiple types of attack will help to make the fighting a bit more varied and add to the experience. So what to do to implement it.

The blockable attack already had a slow-motion feature to it, so I attached a call to a counter-attack function to that. This function was a simple bool check that would check a “Can Counter” true, delay for the period of the slowmotion, which was around half a second (from memory) and then check false. 

Finally, I updated the spartan kick function to be triggered on a right click, when the counter bool was set true. This was achieved by merging blocking with countering – much like I did with jumping and dodging. A simple branch attached to the “Can Counter” bool with a positive leading to a kick animation and a negative leading to blocking.

The UnBlockable attack was already implemented at this point, I just needed to separate the blockable and unblockable using a bool that would also update the Interface function that I had created earlier. Once this was done, the normal attacks were able to be countered and the charged ones weren’t.

Attack Indicators

The aim of these attack indicators were to give the player a visual cue that the enemy was about to attack and give them time to either block or evade the attack in question. Right now, we have two types of attacks that the NPC’s and player is privy to.

  1. Normal attacks
  2. Charged attacks

I’ve settled for icons as that is the most straight forward to implement, however any method I use should be able to be changed to suit different styles. These can include:

  1. Light up parts of enemies
  2. A time bar
  3. Sounds
  4. Haptic feedback

Firstly I created a widget that would be dynamic in that I could feed specific icons that I wanted in there. This treats it more as a space than a dedicated warning for the player. I can also put in health request icons, charms and buff icons, basically any prompt that the player needs to know about. This was put into the master character copy, so icons can also be put above their heads. I put this in the interface call so that I could just plug in the variables (time shown and icon) and use it in any circumstance I wanted to.

Next I put in a call to this empty widget function in the same spot that I put the counter attack call to. The icon for this was a mouse right button click and would trigger a counter attack.

Finally, I put one in the Unblockable Attack function, which would tell the player to dodge (spacebar).


Slow Motion Kill Camera

I say ‘camera’ but this function actually has nothing to do with the camera in implementation. I wanted to slow the game down so that the final blow on an enemy looked more impacting. I have a feeling that this is not going to be the final implementation of this, but I’m not sure of a better way.

This was a quick implementation in the ‘UpdateHealth’ function that would be triggered when a targets health reached below zero. It used the global time scale function built into Unreal and combined it with a delay, then restore.