Help Please. i have a script that has a points varable and a highscore varable. my high score varable is from a different script. the problem is that in my code it goes if(points>=highscore){ }
it comes with this error,
MissingMethodException: Method not
found:
'System.Int32.op_GreaterThanOrEqual'.
Boo.Lang.Runtime.MethodDispatcherFactory.ProduceExtensionDispatcher
()
Boo.Lang.Runtime.MethodDispatcherFactory.Create
()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher
(System.Object target, System.Type
targetType, System.String name,
System.Object[] args) [0x00000]
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher
(System.Object target, System.String
name, System.Object[] args) [0x00000]
Boo.Lang.Runtime.RuntimeServices+<>c_<em>DisplayClass1.b</em>_0
()
Boo.Lang.Runtime.DispatcherCache.Get
(Boo.Lang.Runtime.DispatcherKey key,
Boo.Lang.Runtime.DispatcherFactory
factory)
Boo.Lang.Runtime.RuntimeServices.Dispatch
(System.Object target, System.String
cacheKeyName, System.Type[]
cacheKeyTypes, System.Object[] args,
Boo.Lang.Runtime.DispatcherFactory
factory) [0x00000]
Boo.Lang.Runtime.RuntimeServices.Dispatch
(System.Object target, System.String
cacheKeyName, System.Object[] args,
Boo.Lang.Runtime.DispatcherFactory
factory) [0x00000]
Boo.Lang.Runtime.RuntimeServices.Invoke
(System.Object target, System.String
name, System.Object[] args) [0x00000]
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator
(System.String operatorName,
System.Object lhs, System.Object rhs)
can someone help please, heres my script:
var HighScore;
var HighScore2 = 0;
var points = 0;
var lives = 3;
var WinCube : GameObject;
function Update (){
//add 1 points each frame
points += 1;
//set the highScore var
var HighScoreScript;
HighScoreScript = GetComponent("LoadHighScore");
HighScore = HighScoreScript.ScoreSaved;
print (HighScore);
// cheack if lives = 0
if(lives == 0){
//cheack if points is greater than highscore
HighScoreFunction();
}
// check if transform.x >= 1000
if(transform.position.x >= 1000){
//cheack if points is greater than highscore
print ("pass");
HighScoreFunction();
}
}
function Pass(){
var position = Vector3(0, 0, 0);
Instantiate(WinCube, position, Quaternion.identity);
}
function HighScoreFunction(){
if(points >= HighScore){
//save highscore
GetComponent("HighScore").enabled = true;
//save pass file
Pass();
}else{
Pass();
}
}
function OnGUI(){
GUI.Box (Rect (0,0,100,50), "Score:" + points);
GUI.Label (Rect (25, 12, 100, 20), "Lives:" + lives);
GUI.Label (Rect (25, 24, 100, 20), "High Score:" + HighScore);
}
function OnTriggerEnter (other : Collider){
lives -= 1;
points -= 10;
}
****************** UPDATE ********************
i fogot to mention that HighScore is loadedd via stream.reader