::I’m not well aquainted with the series, so I’m not sure if it is covered in a later part, but you can update your code so that the Flip()
function cannot run when you are attacking, like so:
void Flip()
{
// Prevent turning for 1 second after attacking.
if(timeSinceAttack < 1f) return;
if (xAxis < 0)
{
transform.localScale = new Vector2(-Mathf.Abs(transform.localScale.x), transform.localScale.y);
}
else if (xAxis > 0)
{
transform.localScale = new Vector2(Mathf.Abs(transform.localScale.x), transform.localScale.y);
}
}
You will need to replace the 1f with the amount of time you want to disable attack for.