You can simplify the FlipEnemyFacing method

You don’t really need the velocity or the Mathf.Sign in order to Flip the Goober as all you are doing is toggling the x scale:

private void FlipEnemyFacing()
        transform.localScale = new Vector2(-transform.localScale.x, 1f);

Absolutely, but what’s great with using Mathf.Sign is that you can use the method to ensure that your enemy is looking forward, at Start for example, or even in Update if you think something might disturb it. This is very important since an enemy facing backwards would be stuck against any wall or fall down any hole.

1 Like

Privacy & Terms