Siriel 02 – The flip trick or left and right animation

The character in two 2D game should be able to walk left and right. The movement could be underlined by animation to the left or right.

In old days when computers had very little computational power it was necessary to draw left and also the right animation as you can see in following sprite sheet.

avatar

Today you can save time for drawing one direction of animation and simply use the trick with flip. When direction changes just flip the image.

Here is code snippet from Unity C# script:

void Flip()
{
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

The code and idea is from Unity Live training 16 2013 – 2D Character Controllers – time 42:30.

Here is the updated version 0.2 of Siriel with Flip function. I also fixed the RigidBody2D in z-axis to avoid flying around in different directions with the character.