Join us on Discord!
You can help CodeWalrus stay online by donating here.

Cookie Clicker for the Nspire!

Started by semiprocoder, November 29, 2015, 09:23:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

semiprocoder

COOOOKIIEEEESSSS!!!!!!!!!!!


Yesterday I started working on cookie clicker for the nspire, and here is the first version of cookie clicker for the nspire. Right now it has 9 producers of cookies, including a walrus. It also supports upgrades for each tower and clicking(although I need to balance it a bit still).

Currently the help and settings menu don't do anything, and only game does anything. I may end up removing the settings menu, as I do not see any real use for it.

Controls: use arrow keys to scroll through menu and press enter to go into one of the parts. In the game click on the cookie or the producers to get buy or get extra cookies. Use left and right keys to scroll between the different producers of cookies.
Press 'u' to upgrade producers/mouse. Again click on what you want to upgrade and use arrow keys to scroll.

The images are taken from the actually cookie clicker images, and the background is just a random cool background I found online that I included in my files just to show that my code supports backgrounds. I hope to replace it with something else soon.

Edit:
First off, what do you think about me adding a potato(http://www.lulu.com/shop/rinardo/the-holy-scripture-of-rinardo/ebook/product-22008800.html). I am planning it to be right under walrus or even above it. Also I need to make everything more expensive, as it takes me about 30 mins to get even the walrus.

Here is the list of glitches I know about:

1. Font size:
Despite me setting the font size to 7, which is one of the values the ti nspire supposedly support, the font size stays default. This is really annoying because stuff has to be scrunched too far together and it often goes off screen.

2. Vars not saving properly:
This is probably my bad coding, but anyways, sometimes when you upgrade clicking it resets you clicking power to 0 and the cost to 3. I think I fixed this but I am not sure. Once I come up with larger changes I will update the downloads.
This is probably the most annoying glitch. This only has to do with the var "statsCookieSPC"(money, money per click, and upgrade cost for the money per click. It also only happens if you buy something ie. save something in the var "statsProducerSPC", which stores everything else

3. When you open the game again without closing it fully(like when you open another file), the game doesn't work at all. You have to open something else to make the game work again. Also think I have fixed this.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Dream of Omnimaga

#1
This looks good. I saw an earlier screenshot on IRC and was gonna suggest adding that blue background from the PRIZM version to spice things up. I'm glad that it was already added. Also nice to see :walrii: in the game (you should probably call it Walrii, though :P)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

semiprocoder

#2
Can anyone who knows lua help me with a small(ish) issue?

I have an issue with saving the producer's stats right now. Here is my code(I have print statements there because I was checking what didnt work):

function game.cookieProducer:storeVars()
var.storeAt("statsProducersSPC", self.cost, self.id*4-3)--also needs to be improved
if var.recallAt("statsProducersSPC", self.id*4-3)==nil then
print("cost not working")
end
var.storeAt("statsProducersSPC", self.output, self.id*4-2)
if var.recallAt("statsProducersSPC", self.id*4-2)==nil then
print("output not working")
if self.output==nil then
print("wut")
end
end
var.storeAt("statsProducersSPC", self.amt, self.id*4-1)
if var.recallAt("statsProducersSPC", self.id*4-1)==nil then
print("amt not working")
end
var.storeAt("statsProducersSPC", self.upgradeCost, self.id*4)
end


The issue is that all the print statements are printing(showing that the vars aren't being saved), and my recall vars statement never set my variables because they are all nil.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

I think it's just there as the last item/thing, except instead of the usual Cookie Clicker final item, it's a walrus.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

LD Studios

Quote from: semiprocoder on November 29, 2015, 09:23:42 PM
the first version of cookie clicker for the nspire
lies :P
Yours looks better though :P

Might I suggest adding some more spaces though before text? Like, add a bit of  margin between the left side of the screen and the Money, Output labels, and the same thing for your stats next to the different things you can buy.



Dream of Omnimaga

I seem to recall at least another with a white background, but I forgot who made it. I know that JWinslow23 made two versions, but neither were for the Nspire. Spenceboy98 made a PRIZM version and Kerm a CSE version.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

LD Studios

Quote from: DJ Omnimaga on November 30, 2015, 09:05:53 PM
I seem to recall at least another with a white background, but I forgot who made it. I know that JWinslow23 made two versions, but neither were for the Nspire. Spenceboy98 made a PRIZM version and Kerm a CSE version.
That was probably me with the white background, but then I updated it- Not a very good update though because I added falling cookies in the background which create a lot of lag when you get to higher scores :P



Dream of Omnimaga

Oh right, I didn't realize that the cookies were animated. Is the lag still present on OS 3.6 or was it only on 3.1 and lower?

Also, I wonder if some PICO-8 games would be feasible in Nspire Lua (eg that racing game I posted in the PICO-8 thread)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

LD Studios

Quote from: DJ Omnimaga on November 30, 2015, 09:12:49 PM
Oh right, I didn't realize that the cookies were animated. Is the lag still present on OS 3.6 or was it only on 3.1 and lower?

Also, I wonder if some PICO-8 games would be feasible in Nspire Lua (eg that racing game I posted in the PICO-8 thread)
No, the lag would be present on any OS considering how it outputs one cookie for every cookie created (so when you're outputting thousands per second...)- I could have sworn I blocked it from displaying more than about 30 at a time, but I just tested it and apparently not. *oh well*

There are a fair amount of commands in PICO-8 that don't exist in Nspire Lua such as the setPixel and getPixel (or whatever they're called), as well as tall the built in tilemapping stuff.

EDIT: ***This thread should probably get back on topic though*** :P



Dream of Omnimaga

Yeah the PICO-8 remark is because you seems a bit hard to reach on WalrusIRC sometimes :P. Maybe I should start a new topic about if some PICO 8 games could be feasible in Nspire Lua, though. And yeah I believe that blocking cookies at 30 would be better, or you could only animate 30 a second and loop through a longer list but then the cookies would fall slower  still.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

semiprocoder

#11
Quote from: LD Studios on November 30, 2015, 09:01:07 PM
Quote from: semiprocoder on November 29, 2015, 09:23:42 PM
the first version of cookie clicker for the nspire
lies :P
Yours looks better though :P

Might I suggest adding some more spaces though before text? Like, add a bit of  margin between the left side of the screen and the Money, Output labels, and the same thing for your stats next to the different things you can buy.

Well ldstudios I must apologize then. I only checked on ticalc as I don't participate on omninaga(only really joined calc community in september), and I don't check ti planet cause most of that is french. I'll change that I guess.

Anyways, ldstudios do you know vars well? Because right now I am having great difficulty in saving my money. It may somehow be a glitch of my code, idk, but I don't think so. I printed the values of self.money every timer tick, and they were all good. However, when I closed the game back again and restored the money it is a random value. I am not exactly sure why this happens, but I know it only happens if I buy something first, which saves those values in a different var. I have been trying to figure it out for like an hour, but I have no idea where the issue actually lies.

I will update my lua code for the more updated version and don't pay attention to my old question I fixed that but then this issue arose.

I fixed it after another hour of putting print statements everywhere. I finally figured out that I wasn't setting prevTime to anything when I open my game. Thus the difference between prevTime and millis() the first run of timer was huge and it added a huge amount of money to the game.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

LD Studios

#12
Just a few spots of advice
1) You should make your documents 3.1 compatible ;)
2) I usually use on.save and on.restore rather than saving math variables. I find it to be a little neater in the code, and it also prevents people from cheating by altering the variables from a calculator page, not to mention math variables will take up more space in your document! See here for more info on that.

EDIT:
Quote from: semiprocoder on November 29, 2015, 09:23:42 PM
3. When you open the game again without closing it fully(like when you open another file), the game doesn't work at all. You have to open something else to make the game work again.
There is some sort of bug where the timer glitches out upon minimizing lua documents. I recommend pausing the timer on on.deactivate() and resuming it with on.activate()



semiprocoder

Quote from: LD Studios on December 01, 2015, 01:26:38 AM
Just a few spots of advice
1) You should make your documents 3.1 compatible ;)
2) I usually use on.save and on.restore rather than saving math variables. I find it to be a little neater in the code, and it also prevents people from cheating by altering the variables from a calculator page, not to mention math variables will take up more space in your document! See here for more info on that.

1) no idea how to use string images still(and I think I had one other function that isn't compatible, but I am not sure)
2) I made my code badly and it would take a while to change it to work with on.save and on.restore, so I may do that, but not right now.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Dream of Omnimaga

I agree about 3.1. Some Ndless users still use 3.1 for larger memory and also the annoyances of 3.6 (perhaps they don't want to deal with nLaunchy). But I am ok if the game works on at least OS 3.6. Just don't make it 3.9-only.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal