- Home /
Question by
Lemonizer · Jul 30, 2012 at 07:01 PM ·
errorif statement
Problems with adding multiple conditions
I have an If statement that will make the player jump once, I don't see what I am doing wrong at the moment. Here is the code:
#pragma strict
var jumpforce : float = 50.0;
var isgrounded : boolean = true;
function Update () {
if(Input.GetKeyDown("space") && isgrounded = true){
rigidbody.AddRelativeForce (0,jumpforce ,0);
isgrounded = false;
}
}
I would be grateful if anyone could point out my mistake :)
Thanks in advance.
Comment
One: You forgot to format your code...fixed that for you.
Two: You forgot to describe the error/behavior you get.
Best Answer
Answer by Screenhog · Jul 30, 2012 at 07:08 PM
isgrounded = true
You need two equal signs: ==
Ah, now I see what I did wrong, $$anonymous$$any thanks :)
Your answer
Follow this Question
Related Questions
i cant download anything from the asset store 4 Answers
Problem with editor 1 Answer
unity registration bug 0 Answers
Animation help??! 1 Answer
[Closed] Getting CS0029 error when I try to check position of an object 1 Answer