Login
Back to forumReply to this topicGo to last reply

Posted By

Craft​yMiner1971
on 2023-04-08
23:07:53
 adding high scores to a game

I don't know much about programming at all. I've got a very basic quiz I'm trying to improve on. I have my questions all typed up, but I would like to know how I can add a simple score system to it. I would appreciate it if someone could help me out.

Posted By

SVS
on 2023-04-09
06:22:06
 Re: adding high scores to a game

Hi, to do this you have to work with a file on disk where you'll save the top scores, say 10.
When the game is run, it should load from disk the array of the scores and when requested it will insert the new score, of course if it is greater than the 10th.
For example:
1. ABC 5400;
2. DEF 5100;
3. GHI 4700;
...
10 XYZ 3200.

If the player achieves a score lower than 3200, nothing is to do.
If the player achieves a score say 5200, it has to replace the old 2nd score (in the example DEF 5100). Before to write it, you have to scroll down the current array data starting from element 2 to element 9 (the 10th will be lost). After this just save on disk the updated array.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024