public class PlayerMovement : MonoBehaviour {
public float speed = 1f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// Basic Movement:
if (Input.GetKey (KeyCode.D))
transform.position += new Vector3 (speed * Time.deltaTime, 0.0f, 0.0f);
if (Input.GetKey (KeyCode.A))
transform.position -= new Vector3 (speed * Time.deltaTime, 0.0f, 0.0f);
if (Input.GetKey (KeyCode.Space))
transform.position += new Vector3 (0.0f, speed * Time.deltaTime, 0.0f);
if (Input.GetKey (KeyCode.S))
transform.position -= new Vector3 (0.0f, speed * Time.deltaTime, 0.0f);
}
}
How would I get a second jump to register after the first one? Is there a command to call on my first if(Input.GetKey(KeyCode.Space)) to multiply by two if the GetKey is pressed again in a quick succession? Any help is appreciated, thanks!
put a timer in, on first space key hit, setting a bool to be true. This remains true until the time limit, half a second or so it true, or if player presses space with in that time frame. If he does press space while bool is true, this signifies a double jump. As such, apply the appropriate force.