Basic Movement Glitch

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

How do I fix a combat glitch where attacking and moving in the opposite direction freezes the character?

What is the expected result

Attacking while holding a different movement key should attack in the original direction held.

What is the actual result

After attacking while facing one direction, and then turning to face the other direction, the character freezes until you attack again. Something went wrong with the game I was making this for, but while I’ll have to scrap the game itself, I want to save the code here because it’s the best movement I’ve done yet.

Related screenshots


Your description is a bit ambiguous. Is it when the player faces a direction, ‘K’ is pressed to attack and then, before the attack animation has finished another key to change direction is pressed?

If so, it’s because the variable “Attacking” is set to 1. This prevent the key press from being actioned, But while “Attack Combo 1” or “Attack Combo 2” animation is playing, another key is pressed and then released. The release state set the animation to “Idle”. Because of this, the “Attack Combo 1” or “Attack Combo 2” animations never finish, that event checking for that never actions and the variable “Attacking” is never reset to 0.