using UnityEngine;
using System.Collections;

public class Player_Flip : MonoBehaviour {
	private bool facing_right = true;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		float h = Input.GetAxis("Horizontal");
		if(facing_right && h < 0)
		{
			Flip();
		}
		else if(!facing_right && h > 0)
		{
			Flip ();
		}
	}
	void Flip()
	{
		facing_right = !facing_right;
		
		Vector3 tmp = transform.localScale;
		tmp.x = tmp.x * -1;
		
		transform.localScale = tmp;
	}
}
