Not a overly flashy game. but a personal challenge I set my self to better understand how to code.
I wanted to make a very basic calculator to better understand how to input and compare variables and output an answer. the two variables will increase in randomness based on your correct answer score. The operation are limited to addition subtraction and multiplication, No division as that would require a decimal place or to check the answer is a whole number which i have yet to finger-out.
use arrow key to navigate key pad.
press Z to input your answer
press X to submit your answer (or select the return button on key pad)
selecting the C button on key pad will clear your current answer.
If anyone know how to check for a whole number please put in comments below
having a issue with numbers over 9999? seems to generate is know random number if i try to input a number over this. Is this a limitation with the programming language or my programming skills?
As a retro console, Pico-8 has many charming quirks.
One of the ones most likely to blindside you is that the numbers can only go up to 32767.99
That's probably related to the problem you mention at the end of your post. If you need larger numbers, you'll have to do something clever.
Good work on the game. It's an accurate homage to all those tedious games that were installed on school computers back in the 80s!
EDIT: Here's an example cart
If you need to go over the integer limit, you can store your number as multiple numbers, just have have each cover 4 or 5 places. For example.. (I used this in an old arcade game project I never released but maybe it will help?)
To calculate score:
score += points while score >=10000 do //moves the points over 10,000 to a separate variable score2+=1 score-=10000 end
To get score for display:
function get_score(s2,s1) //returns the combined values of //the 2 score variables, padded as necessary local txt = '' local txt1 = '' local txt2 = '' --10,000 txt1=''..s1 while #txt1 <4 do txt1 = '0'..txt1 end txt2=''..s2 while #txt2 <3 do txt2 = '0'..txt2 end txt=txt2..txt1 return txt end
Thanks apLundell and enargy
for the clarification of what is happening and for a awesome work around.
I will no doubt will use this in latter project or this one if I can figure how to solve my other problem of on diving into whole numbers.
[Please log in to post a comment]