Page 1 of 1

How to add a highscore Tutorial

PostPosted: Thu Feb 24, 2011 3:40 am
by again
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

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

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

4th and final step (yes its almost over) Click on your highscore / click on draw actor / and put this code

Code: Select all

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!!!!

Re: How to add a highscore Tutorial

PostPosted: Fri Feb 25, 2011 1:27 pm
by again
What you have now accomplish is something advanced , a major achivement as saving is a difficult part of game making.

1) Made a variable and put it in a save group (name, save group)
2) Made the variable equal the highscore ( highscore.textNumber=variable)
3) Now when you die you made the variable saved and made a separate file which to save ( saveVars " your made up file""save group your variable is in")
4) Finally you made the variable load in the highscore when the game starts (loadVars"your made up file name" "save group your variable is in" )

If for some reason you had trouble please feel free to ask question. If you would like a demo I made a fun game called Mario Kart Mini in the game demo section so you can see highscore in action. Play this game to see highscore being saved.