using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { private Animator anim; // Reference to the animator component. public Rigidbody2D rb; private void start() { rb = GetComponent(); Animator anim = GetComponent(); anim.SetBool ("Jump down", false); } private void Update() { if (Input.GetKey(KeyCode.RightArrow)) { rb.velocity = new Vector2(2f ,0f); //this will move your RB to the right while you hold the right arrow } if (Input.GetKey(KeyCode.LeftArrow)) { rb.velocity = new Vector3(-2f ,0f); //this will move your RB to the left while you hold the right arrow } if (Input.GetKey(KeyCode.UpArrow)) { rb.velocity = new Vector4(0f ,2f); //this will move your RB up while you hold the right arrow } if (Input.GetKey(KeyCode.DownArrow)) { anim.SetBool ("Jump Down", true); } } }