The C# class defines a Boolean variable, facingRight, that stores a true/false value that corresponds to whether the bug is facing right. Since our bug sprite was initially facing right, we set the initial value of facingRight to true to match this.
Every frame, the Update() method checks whether the Left or Right arrow keys have been pressed. If the Left arrow key is pressed and the bug is facing right, then the Flip() method is called; likewise, if the Right arrow key is pressed and the bug is facing left (that is, facing right is false), the Flip() method is called.
The Flip() method performs two actions; the first simply reverses the true/false value in the facingRight variable. The second action changes the +/- sign of the X-value of the localScale property of the transform. Reversing the sign of localScale results in the 2D flip that we desire. Look inside the PlayerControl script for the PotatoMan character...