This is a code that I am working on for a space shooter. Part of it works and my score does increase by 7 every second but my script does not load my scene when the number reaches 1000. I have made sure that my scene is a part of my build settings and I have tried some fixes but it doesn't load even though I don't get any sort of error. Any Ideas?
#pragma strict
function Start(){
InvokeRepeating("EachSecond",1.0,1.0);
}
var score: int = 0;
var addscore = 7;
function EachSecond()
{
score=score+addscore;
}
function OnGUI(){
GUI.Box(Rect(1000,10,100,25), score.ToString());
}
function WinningScore()
{
if (score >= 1000 )
{
Application.LoadLevel("Win");
}
}
↧