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++;
}
}
}
Yeah xD first thing I noticed :p please delete the question :)
– anon73820239