- Home /
Scripting Error Help Needed
I'm a newbie and making a game where you are a ball and you roll around and stuff but when I scripted the jumping it stopped working and gave the errors, expecting ), found '='. Also ';' expected. Insert a semicolon at the end. But I'm not aware of where I have missed a semi colon. Could anyone help me please? Here's the code it is not very long
var rotationspeed = 100;
var jumpheight = 8;
private var isFalling = false;
function Update ()
{
//Handle ball rotation.
var rotation : float = Input.GetAxis ("Horizontal") * rotationspeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
if (Input.GetKeyDown(KeyCode.W) && isFalling == false);
(
rigidbody.velocity.y = jumpheight;
)
isFalling = true;
}
function OnCollisionStay ()
{
isFalling = false;
}
Answer by stevethorne · Mar 06, 2014 at 04:32 PM
Your problem is that you're using parentheses on line 14 instead of brackets
your if statement should look like this
if (Input.GetKeyDown(KeyCode.W) && isFalling == false)
{
rigidbody.velocity.y = jumpheight;
}
Oh good catch, I completely missed that... I saw the extra semicolon and figured that was it
The extra semicolon shouldn't actually cause an error. The code inside the brackets will simply be run no matter what.
Answer by perchik · Mar 06, 2014 at 03:37 PM
You don't need the semicolon after the if statement on line 12:
if (Input.GetKeyDown(KeyCode.W) && isFalling == false)
Your answer

Follow this Question
Related Questions
Error BCE0044 JavaScript 1 Answer
When I kill one enemy, the rest disapear, but still shoot 1 Answer
Script copied exactly, yet I get the console errors 1 Answer
Incremental game need help 1 Answer
Unknown identifier "If" (Javascript) 2 Answers