- Home /
how to make a level load after hitting a score
I dont know any coding and I was wondering does anyone have a script that will load a level after hitting a score.
Thanks
Comment
Best Answer
Answer by whydoidoit · Jun 30, 2012 at 10:46 PM
Like this:
Create a score script - let's call it Score.js
static var score : int;
var nextLevelScore : int;
var nextLevelName : string;
function Update() {
if(score > nextLevelScore) {
Application.loadLevel(nextLevelName);
}
}
In each level attach this script to a game object and use the inspector to set the values.
Add to the score using Score.score e.g.:
Score.score += 10; // add 10 to score
Score.score = 0; // initialize the score at the start of the game
Thanks Ill try it later .. I know your last one worked so I assume this one will.
Thanks
Got an error .. BCE0018: The name 'string' does not denote a valid type ('not found'). Did you mean 'Boo.Lang.Compiler.IO.StringInput'?