- Home /
Please help me with my unity puzzle game scripts
I have seperate script
Puzzle script: which working properly
Score: which is my problem. its not generating score.
LevelComplete: My main problem
Im having problem with running it correctly
heres my score script:
static var Score : int;
var Buttonskin : GUISkin;
function OnGUI()
{
GUI.skin = Buttonskin;
GUI.Box(Rect(150,60,100,50),"");
GUI.Label(new Rect(160,73,100,50),"Score :" + Score);
}
please correct it if theres something wrong
heres my LevelComplete Script:
var shoF : boolean;
var Buttonskin : GUISkin;
function OnGUI(){
GUI.skin = Buttonskin;
if(1.o11 == 1 && 2.o11 == 1 && 3.o11 == 1 && 4.o11 == 1 && 5.o11 == 1 && 6.o11 == 1 && 7.o11 == 1 && 8.o11 == 1 && 9.o11 == 1 && 10.o11 == 1 && 11.o11 == 1 && 12.o11 == 1 && 13.o11 == 1 && 14.o11 == 1 && 15.o11 == 1 && 16.o11 == 1){
if(GUI.Button(new Rect(400,100,200,50),"Level Complete")){
Application.LoadLevel("NextPuzzle");
}
}
}
I have named all my tile in the hierarchy:
its a 16 tile image puzzle
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,Slot(for the empty slot)
i have also created a script in each tile that will access my Score script:
here's one of the script:
static var o11 : int;
function OnTriggerEnter(other : Collider) {
if(other.gameObject.tag == "15"){
Score.Score += 100;
o11 += 1;
}
}
function OnTriggerExit(other : Collider) {
if(other.gameObject.tag == "15"){
Score.Score -= 100;
o11 -= 1;
}
}
Please help me!!! I'm sorry for my lack of knowledge Thank you!!
Answer by spectre1989 · Aug 11, 2013 at 01:49 PM
Try static var Score : int = 0; and static var o11 : int = 0;
Your answer
Follow this Question
Related Questions
Accessing variables from scripts issues 1 Answer
Is there a "library" of scripts? 1 Answer
Problems with javascript 0 Answers
Difference between scripts. 1 Answer
Setting Scroll View Width GUILayout 1 Answer