Log In  


BUTTON

Hey guys! I just made my first PICO-8 game, completely from scratch :)

I know it isn't much, but I'd like some feedback on it! Thanks for checking it out :D

Cart #button1_1-0 | 2022-06-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

Changelog

v1.0 - Release

  • Press the button with Z!
  • Upgrade how many presses you get each time you press the button with X!
  • Clear data by pressing up, then down.

v1.1 - Menu Option

  • Added menu item to clear data.
  • You can no longer clear data the previous way.
7


1

You have the foundation for a good clicker game, @Nayz. Gold star.

The best I have ever seen though is called, "BLIP BLOP" with many bonuses and power-ups you can earn.

https://www.youtube.com/watch?v=nTAuRNcaZvA


Thank you for the input @dw817! I'll check it out, maybe I can glean some inspiration from it :)

The main thing stopping me from adding more is the fact that I can't really think of an efficient way to implement a menu :/


Hi @Nayz:

Menus in Pico-8 are quite easy to create. Try copying this code directly to Pico-8:

function _init()
cls()
menuitem(1,"try this",function()this()end)
end

function _update()
end

function this()
  print("that")
end

Run this code. Press "P" to pause it and bring up the menu. Notice the new menu item, TRY THIS
Select it to run the function this() which returns the text, THAT

You can find full help on this feature HERE:

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Custom_Menu_Items

hope This Helps !


Oh, yeah, I know how to use menuitem(), I just meant like actually making the game go to a different screen, you know, like with options and other graphics and stuff


Oops! I overflowed the variable! It was easy )


@BogdaBard oh, haha, didn't realize it was that easy to do that. Any way to avoid the possibility of that happening?


One way would be to have several currencies. So one lever equals 1000 buttons, and one zoing equals 1000 levers.

Another way is to actually implement big numbers by storing your numbers as string in pico and doing some maths.


@caranha of course, right! thanks for the insight!


One way to handle multiple screens is to store the sprite position data for each screen, then track a screen state var.

There are methods to make this less token-intensive if you reach token limits, such as string splitting.

screen_sprites={}
screen_1_sprites={{sprite_id,x,y},{sprite_id,x,y}}
add(screen_sprites,screen_1_sprites)
screen_2_sprites={{sprite_id,x,y},{sprite_id,x,y}}
add(screen_sprites,screen_2_sprites)
-- and so on; good use case for a function

Then when you want to switch screens, just switch which collection of sprites you're drawing.

screen=1
current_sprites=screen_1_sprites
if(btnp(0))screen-=1
if(btnp(1))screen+=1
if(screen>#screen_sprites)screen=1
if(screen<0)screen=#screen_sprites

current_sprites=screen_sprites[screen]

-- draw the sprites

Alternate button handling

if(btnp(0))screen=max(0,screen-1)
if(btnp(1))screen=min(#screen_sprites,screen+1)

You might also just have a single collection of sprite tables, and give each sprite table a screen number. Then your draw function would check each sprite's screen number against the current screen number and draw if it matches.


Another way to avoid overflows is to use 0x0.0001 as your increment - tostr() has a feature to print PICO-8 numbers as integers, which increases the limit from 32,767 to 2,147,483,647.

Which still might be too small for a really aggressive clicker game, but at that point it probably makes sense to implement bignums in some way.



[Please log in to post a comment]