Perhaps the simplest 2D animation is a simple flip, from facing left to facing right, or facing up to facing down, and so on. In this recipe, we'll add a cute bug sprite to the scene, and write a short script to flip its horizontal direction when the Left and Right arrow keys are pressed:
Flipping a sprite horizontally – the DIY approach
Getting ready
For this recipe, we have prepared the image you need in a folder named Sprites in folder 08_01.
How to do it...
To flip an object horizontally with arrow key presses, follow these steps:
- Create a new Unity 2D...