i wrote out a function so when currentScore == 6 it loads level 2, but it wont do it.why?
here's the script:
#pragma strict
static var currentScore : int = 0;
var offsetY : float = 40;
var sizeX : float = 100;
var sizeY : float = 40;
function Start (){
currentScore = 0;
}
function OnGUI (){
GUI.Box (new Rect (Screen.width/2-sizeX/2, offsetY, sizeX, sizeY), "Score: " + currentScore);
}
function LoadLevel()
{
if (currentScore == 6){
Application.LoadLevel("Level 2");
}
}
↧