using UnityEngine; using System.Collections; public class InBetween : MonoBehaviour { private Rigidbody2D Player; private Animator myAnimator; [SerializeField] private float speed; private bool LookRight = true; private bool canMove = true; private bool canJump = true; // Use this for initialization void Start() { Player = GetComponent<Rigidbody2D>(); myAnimator = GetComponent<Animator>(); //required for animation ******* } // Update is called once per frame void Update() { Jump(); } private void Jump() { if (Input.GetKeyDown(KeyCode.UpArrow) && canJump) { canJump = false; Player.AddForce(new Vector2(0, 400)); } } void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "ground") { canJump = true; } } }