Trying my best at a 2d side scrolling infinite runner, but I cant seem to get the character to jump. When I press space he starts flying up constantly without coming down. Please help me out, and thanks in advance.
#pragma strict
var myForce : float = 25;
var jumpForce : float = 25;
function Start () {
};
function Update () {
if(Input.GetKeyDown(KeyCode.Space));
{
rigidbody2D.AddForce(Vector2.right * jumpForce);
};
};
function FixedUpdate () {
rigidbody2D.AddForce(Vector2.right * myForce);
};