No, not yet. I spent the remainder of my time yesterday trying to debug a problem with the “New high score” screen, which I’ll discuss below.
I played it on my real Arduboy. It’s kind of fun for a while but gets boring quickly, since once it starts you just sit back and watch, with more or less random results. Even the setting of the vectors at the start is kind of like rolling dice, with little skill involved. (You’re welcome to point out the same thing about my ArduboyLife sketch in this respect
)
I have a couple of suggestions:
- After the first time, when starting a new game after displaying the score(s), skip the intro screen and instructions and go straight to setting the vectors. It becomes tiresome to manually have to skip these screens each time.
- Add a way to reset the high score. If another sketch has written values to your EEPROM save area you can end up with a huge high score value. Also, people may want to reset the high score, (for example, if someone else was playing the game), without having to load a separate sketch to clear EEPROM.
Now, regarding the problem I mentioned above with the “New high score” screen:
On my Arduboy-Z ARM based system (not on a real Arduboy) this screen is either skipped completely if the high score is 9999 or less, or the game locks up on a blank screen if the high score is 10000 or higher. After some experiments, I think it has something to do with the sprintf() function used to format the NEW HIGH SCORE! message. I didn’t go far enough to determine the exact problem. It could be the \n
line break included, or maybe just the long length of the format string. I didn’t investigate further because I suggest that you don’t even use sprintf()
In addition to printing strings, the print() function is able to format and print numbers. Your use of sprintf() is simple enough that it’s easy to just use print() instead.
Here are changes that I made to eliminate using sprintf() (I’ve commented out the original code):
The text[]
array is no longer needed:
//char text[24];
In the three blocks that use sprintf():
arduboy.setCursor(0, 0);
// sprintf(text, "%li", distance);
// arduboy.print(text);
arduboy.print(distance);
arduboy.setCursor(25, 30);
// sprintf(text, "NEW HIGH SCORE!\n %li", highscore);
// arduboy.print(text);
arduboy.print(F("NEW HIGH SCORE!"));
arduboy.setCursor(48, 38);
arduboy.print(highscore);
arduboy.setCursor(30, 19);
// sprintf(text, "SCORE: %li", distance);
// arduboy.print(text);
arduboy.print(F("SCORE: "));
arduboy.print(distance);
arduboy.setCursor(10, 34);
// sprintf(text, "HIGH SCORE: %li", highscore);
// arduboy.print(text);
arduboy.print(F("HIGH SCORE: "));
arduboy.print(highscore);
sprintf() pulls in a lot of code for its formatting logic. With the changes above, the displayed output is the same as before but the code size is reduced by 1266 bytes.