How to add a highscore Tutorial
Posted: Thu Feb 24, 2011 3:40 am
Your going crazy because you dont know how to save your highscore, well now you do , lets get it.
Step by Step
Now name your highscore actor highscore ok before starting the rest. Also name your regular score actor score ok that make this easier and bug-free.
1)Go to global code(the gray tab on top bar of screen)click on the variable tab / click on add /fill it in like this /
NAME: hscore
SAVEGROUP: nscore
2) Ok go click on your player( the person you controling) click on collision , pick any object that kills you, and put this code in script editor
3)ok now go click on the highscore actor( make sure the name of highscore is highscore) now click on create actor and go to script editor
and put this code in
4th and final step (yes its almost over) Click on your highscore / click on draw actor / and put this code
Thats it your done and it will work . If in the crazy case it doesnt , look over the code. Remember to name your regular score name it score and your highscore name it highscore. Also on your computer a h.file will be in the folder. Thats your highscore save file so dont worry its not something wierd. Best of luck!!!!
Step by Step
Now name your highscore actor highscore ok before starting the rest. Also name your regular score actor score ok that make this easier and bug-free.
1)Go to global code(the gray tab on top bar of screen)click on the variable tab / click on add /fill it in like this /
NAME: hscore
SAVEGROUP: nscore
2) Ok go click on your player( the person you controling) click on collision , pick any object that kills you, and put this code in script editor
- Code: Select all
saveVars("h.file","nscore");
hscore=highscore.textNumber;
3)ok now go click on the highscore actor( make sure the name of highscore is highscore) now click on create actor and go to script editor
and put this code in
- Code: Select all
loadVars("h.file","nscore");
highscore.textNumber=hscore;
4th and final step (yes its almost over) Click on your highscore / click on draw actor / and put this code
- Code: Select all
if(score.textNumber>highscore.textNumber)
{
highscore.textNumber=score.textNumber;
hscore=highscore.textNumber;
}
Thats it your done and it will work . If in the crazy case it doesnt , look over the code. Remember to name your regular score name it score and your highscore name it highscore. Also on your computer a h.file will be in the folder. Thats your highscore save file so dont worry its not something wierd. Best of luck!!!!