Strange errors in javascript

Im trying to make a spam check for my game, where the player cannot instantiate any more objects so long as there is one already on the field. To do this ive simply added a variable ( a bool really, but its a float) that is increased when the ball is instantiated and decreased when it is destroyed.

But for some reason after putting in my if statement, it gives me weird errors. Im not that well versed in Javascript as i am in C#, so perhaps my if statement is wrong, but im not sure.

the errors are telling me to insert semicolons where they dont belong.

static var ballCheck : float = 0;
var arrow : GameObject;
var power : float = 200;

function Update() {
  if ( Input.GetKeyDown( KeyCode.Mouse0 ) ) 
  {
        if (ballCheck == 0;)
        {
        var anArrow = Instantiate( arrow, transform.position, transform.rotation );
        //anArrow.rigidbody.AddForce( transform.forward * power );
        TextBoxPoints.points -= 1;
        ballCheck++;
        }

    }
}

2 Answers

2

Well it turns out i left a semicolon after my condition.

nevermind then.

Yeah xD first thing I noticed :p please delete the question :)

Nice of you to catch your own mistake there.

Not sure if this is C# migratory thing, but I prefer to keep the { brackets in the same line as the if statement. I come from an Actionscript background though, and I just found it easier to organize that way.