My guess would be a problem with negative scale (or zero in other cases).
I recommend using a **rotation** of 180° on the proper axis, probably the Y-Axis, but it depends on your project setup.
transform.Rotate(0, 180, 0);
In your case it would be:
// Flip sprite / animation over the x-axis
protected void Flip()
{
isFacingRight = !isFacingRight;
if (isFacingRight)
transform.Rotate(0, 180, 0);
else
transform.Rotate(0, 0, 0);
}
**Note:** You might wanna reverse the if/else statements depending on the way your sprite is facing initially.
↧