I am having a huge problem with getting my code to work right. I want to move left right up and down, but I keep getting errors with my code. This is my very first game made and I just started coding, but I think I got most of it right.
CODE(BELOW)
#pragma strict
var moveup :KeyCode;
var movedown :KeyCode;
var moveleft :KeyCode;
var moveright :KeyCode;
var speed : float = 10;
function Update ()
{
if (Input.GetKey(moveup))
{
rigidbody2D.velocity.y = speed;
}
else if (Input.GetKey(movedown))
{
rigidbody2D.velocity.y = speed *-1;
}
else
{
rigidbody2D.velocity.y =0;
}
if (Input.GetKey(moveleft))
{
rigidbody2D.velocity.x = speed *-1;
}
else if (Input.GetKey(moveright)).x = speed;
{
else
{
rigidbody2D.velocity.x =0;
}
};