using UnityEngine;
using System.Collections;

public class PlayerMove : MonoBehaviour
{
    public float moveSpeed = 5;

	GameObject playerSprite ;
	Animator anim;

    void Start()
    {
		playerSprite = GameObject.Find("PlayerFeet");
		anim = playerSprite.GetComponent<Animator> ();
    }

	// Update is called once per frame
	void FixedUpdate ()
	{

        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
		if(Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)
		{
			anim.SetBool ("IsWalking", false);
		}
		else
			anim.SetBool ("IsWalking", true);

        rigidbody.velocity = movement * moveSpeed;


	}
}
