I put this together for a game I'm working on, but I thought it might be useful to folks as a standalone cart. The code is clearly segregated between the demo and the actual high score code, so should be easy to lift and shift, or feel free to adapt as you like.
To try the demo: left and right increase/decrease the score, up checks the score against the high score table and switches to score entry if your score is high enough.
Features:
- Large score support (from the discussion here: https://www.lexaloffle.com/bbs/?tid=3577 )
- "Fancy" High score table display
- Inline entering of high score name (3 characters to fit in with the 80s/90s game vibe, but could be extended easily enough)
- Persistence of the save data (uses dget and dset, I know you can store more using alternative methods, but I believe you then lose that data if the cartridge is updated)
Haven't needed to worry too much about token counts yet - its not a huge amount of code as it is, but I might optimise it a bit more in the future, but I don't want to impact the readability.
Well you've got a cool high-score routine anyways, Grumpydev.
I like the way your cart chooses a vertical quadrant where you enter your name right there on the screen, instead of default at the bottom and after name entry, making it appear at the top.
I might recommend you NOT use TABS in your coding though as if you try to search for something with CTRL+F, unless you are IN that tab, it will NOT show up in a search.
Hopefully ZEP will fix this next release.
Just wanted to say thanks for sharing this code! With a little bit of tweaking I was able to slot it nicely into my game (even if I was very confused at first why my scores were multiplied by 65,536!)
That's a great tip merwok! I've always found the Ctrl + F search limited, so I usually open my code in Notepad to see it all. I'll use this in future!
[Please log in to post a comment]



