I understand how to do basic blocking, click the block button, turn on a blocking variable, and while character is blocking they cannot be damaged.
What I’m hoping to do is make it only block damage from one direction. If I am facing an enemy and block, I avoid damage to the front, but if I’m fighting two enemies and one hits me in the back, I want to take damage. Any suggestions on how to do this?
I’ve experimented with creating a collision box in front of the player, so whenever I hit the block button, it turns on collision, and when the enemies sword overlaps, it cancels the attack and causes the enemy to recoil/stagger back. The issue is, when getting attack from behind, the enemy sword still hits the collision box and cancels the attack, etc.
The attacking system I have is; a weapon blueprint, each weapon has a collision box, when the collision box of the weapon overlaps with an enemy’s Collision Cylinder, it applies damage. Far from a perfect system, but this is what I’ve done so far. When the enemy hits a blocking player, it turns on a “recoil” so the logic is, if the enemy is recoiling, damage isn’t applied. Part of the problem I have is, the enemy gets really close, and when it swings it’s sword, it will sometimes trigger an overlap w/ the capsule before the block box, which is why I added this delay before applying damage.