how to flip and move player in unity 2d code example
Example: how to make player flip when pressing a d unity 2d
void Update ()
{ //This short code makes player flip when the A and D or arrow keys are pressed.
Vector3 charecterScale = transform.localScale;
if (Input.GetAxis("Horizontal") < 0)
{
charecterScale.x = -10;
}
if (Input.GetAxis("Horizontal") > 0)
{
charecterScale.x = 10;
}
transform.localScale = charecterScale;
}