Log In  

Cart #beyond32767-2 | 2022-11-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1
(v02 11-21-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type: load #beyond32767

Use the joystick to navigate this cart.

Press UP to increase the score with a random value of 1 to 1000.
Press DOWN to decrease the score with a random value of 1 to 1000.
Press LEFT to reset the score back to zero (0).
Press RIGHT to set the score to exactly 32767. The standard upper limit.

Be aware that the score is saved every single frame. This is not a slow process and occurs almost immediately. So when you reboot the cart or come back to it later, it will contain the last value you had in it. Please see the sourcecode for more notes and details.

Run the code above and see that it is indeed counting beyond 32767 and in fact can go all the way up to 2,147,483,647 - so 2-billion and then some is not so bad to keep track of a player's score ! :)


The other method is given to us thanks to @GPI. While this has been used many times over in previous games for different systems and consoles all the way back to the original arcade, it is important for you to understand how it works, its method and simplicity of coding.

Quite simply you are visually adding 00 to the end of your score so when you add 1 to SCORE it appears as if you added 100. A sample cart follows:

Cart #doublezeroes-1 | 2022-11-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1
(v01 11-21-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type: load #doublezeroes

Press UP to visually increase the score by 100.
Press DOWN to visually decrease the score by 100.
Press LEFT to reset the score back to zero (0).
Press RIGHT to set the score to appear as 32700.

Be aware when you press RIGHT it is only changing the score to 327, not 32700. So you can =count= past 32767 this way.


The first cart above takes advantage of the fact that ZEP has already granted us long integer numbers already, albeit a little tricky to access through the tostr() and tonum() function.

Examine the code to both of these and you might find it simpler to code than the standard method of writing a function that saves 2-different variables for the 8-digits of a score to get past the 32767 number limit.

HOPE THIS HELPS !

P#121134 2022-11-21 20:45


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-01-29 12:42:31 | 0.030s | Q:19