Highscore
in
Programming Questions
•
4 months ago
Hello people,
I am having a problem with my code. I am trying to make a small interface for an arcade game with highscores. Everything is working except that the highscores are not listed from highest to lowest. I have no idea how to do this.
Here is the part of the code that loads the highscores:
//++++++++++++++ Highscorescreen ++++++++++++++++++//
void updateHighscore() {
scoreTable = scoreTable + score + " " + username;
String[] list = split(scoreTable, '_');
saveStrings("Highscore.txt", list);
}
void loadHighscore() {
String lines[] = loadStrings("highscore.txt");
for (int i = 0 ; i < lines.length; i++) {
scoreTable = scoreTable + lines[i] + "\n";
}
}
1