How can I make this script double jump instead of being able to hold to jump higher.
Edit: and also how do you make it to where my player does not roll over when he its a corner
C#
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
public GameObject Character;
public float jumpSpeed = 5f;
public float Speed = 5f;
public bool canControl;
void Update()
{
if(canControl == true)
{
float h = Input.GetAxis("Horizontal") * Speed;
Character.transform.Translate(h*Time.deltaTime,0,0);
}
if (Input.GetKey(KeyCode.W)) {
Jump ();
}
}
void Jump(){
GetComponent<Rigidbody>().AddForce(Vector3.up * jumpSpeed);
}
}