Highscore help!
in
Programming Questions
•
2 years ago
I am creating an offline highscore system for a simple "survive" game. Here's how it works. You start the game and have two displays called "score" and "highscore". I coded it so that the score will rapidly rise and if highscore is less than score highscore will equal score. That works. I have also made it so that it will save the highscore to a .dat file. I used the examples in the reference to read and print to text files. It works perfectly and will save your highscore once you press "esc" and when you load the game again, it will load your highscore. Now this is where it doesn't work. If you quit out of the game when you've loaded the highscore and you haven't beaten your previous highscore and you quit out, the game will erase the highscore the next time you boot the game. If you
have beaten the highscore and quit out it will save the highscore for the next time you load the game. I can't figure out why it does this, from my understanding it should always save the highscore... help would be extremely appreciated. If you need any code, I will be glad to provide it. I've searched through the forum (old and new) and haven't found anything that could help my problem.
Thanks,
TheGamersHaven
Thanks,
TheGamersHaven
1