I have began coding a controller for a 2D game and I am having a few issues. Could anyone help me out please! 
Code
#pragma strict
var moveUp : KeyCode;
var moveDown : KeyCode;
var moveRight : KeyCode;
var moveLeft : KeyCode;
var speed : float = 10;
var jumpHeight = 8;
function Update ()
{
if (Input.GetKey(moveUp) && isFalling == false)
{
rigidbody2D.velocity.y = jumpHeight;
}
isFalling = true;
else if (Input.GetKey(moveDown))
{
rigidbody2D.velocity.y = speed *-1;
}
else if (Input.GetKey(moveRight))
{
rigidbody2D.velocity.x = speed;
}
else if (Input.GetKey(moveLeft))
{
rigidbody2D.velocity.x = speed *-1;
}
else
{
rigidbody2D.velocity.y = 0;
rigidbody2D.velocity.x = 0;
}
}
you should set isFalling to false when you land and set it to false when you jump. function OnCollisonStay2D( collision2D :Collision2D) { if(collision2D.comparetag("Ground")) isFalling = false; }
– mujpirHi, I am trying to implement this within my code right now. The problem is I've never seen these pieces of code before and I'm not sure where they go! Also when you jump wouldn't isFalling be true? Could you show me how the code should be please?
– iamkirkos"{" is a bracket
– KiraSenseiThanks. I was just wondering if it had a different name within the coding world!
– iamkirkosCurly brace/bracket :D
– meat5000