- Home /
Answer by BiG · Dec 13, 2012 at 11:53 AM
You could elaborate your question a little, just for giving more details about what you want. By the way, do you know about PlayerPrefs?
Sure, basically when the game is over, the highscores are displayed...with names and score...updated every time there is a better score...i would actually go with like a top 20 i think...
Somthing like this
Chuckler 20000
Other Dude 18250
next guy 17500
forth player 16000 etc... and no i don't yet know about player refs..! I be green :)
So, you could use an array of PlayerPrefs (http://wiki.unity3d.com/index.php/ArrayPrefs), with 20 entries (that are the 20 top scores).
At each "game over", you can compare the actual score (the score reached at the game over) with the last entry of the array: if the new score is greater than that, you have realized a new score that have to be registered in the highscores list.
At that point, you have to "scan" your array, finding the correct place for the new entry and updating the others. As an example, a new score of 18.000 points would be, regarding your example at the top, inserted at the 3° position.
I know that it's nothing more than a starting point, but it's a bit hard to give an exaustive answer without starting from some code. I recommend to investigate arrayPrefs a little (they are easy to understand...). Then, if you are already familiar with arrays, the things should be easy to implement.