Log In  

BBS > Superblog
Posts: All | Following    GIFs: All | Postcarts    Off-site: Accounts

Cart #23349 | 2016-06-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

View on Github.com

You miss built-in lua functions such as ipairs or getmetatable in pico-8? Well, fear no more.

Currently supported Lua "built-in" functions

    getmetatable
    setmetatable
    rawget
    unpack
    ipairs
    table.pack
    table.unpack as an alias to unpack
    table.insert
    table.remove
    table.sort

Tested to imitate their counterparts

Travis-CI is set to test missing.lua against test.lua, which compares results of this library functions with the built-in ones. Well, tests may be incomplete, so do not hesitate to flag a bug to the issue tracker if something goes wrong.

[b]How to use

[ Continue Reading.. ]

4
4 comments


Cart #23051 | 2016-06-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Cart #22812 | 2016-06-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Sanic Rick 0.1

Collision is now "perfect".
Fully commentated code for beginners to see and think about.

4
0 comments


Cart #23035 | 2016-06-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
109

FEATURES INCLUDE:

  • Bumpin' soundtrack
  • Freakishly lifelike graphics
  • Cute lil sloth guy
  • Relatively breakneck speeds
  • Innovative day/night system
  • Vast array of 7 different obstacles
  • Puns

(The point of the game is to see how long you can play before killing yourself out of boredom)

Version History:


v1.0:
Initial release!

v1.1:
Fixed a bug where day doesn't get reset after restarting game. My bad.

v1.2
Fixed a bug where tally marks get screwed up once you hit ~240 points, which is an absurdly high number of points. Thanks so much to @le_gars for finding and fixing this!

109
39 comments


Cart #22781 | 2016-06-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
26

26
6 comments


For your games, you could have to manage a score greater than 32768 (I like games were I can score millions), and often, you want the score displayed in a fixed length, prepended with zeros (00072635).
But managing this can consume lot of tokens.

I came accros a solution I'm quite proud (I'm still learning Lua...) and wanted to share.

In Lua, if you do : "the score is "..score , score is converted into a string and then concatenated to the first one.
So to convert a number into a string, you just have to write : ''"..score

I wrote a recursive function that takes a string and a number (the length) and returns a string padded with zeros at its beginning to reach the desired length :

function pad(string,length)
  if (#string==length) return string
  return "0"..pad(string, length-1)
end

score=723
print(pad(""..score,7))  -- will display 0000723

Elegant and thrifty, isn't it ?

Then, you can use two variables, score2 will store the 10 thousands, score1 anything under 10000
each time your player scores something, you add it to score1 and you test if it's above 9999 :

if score1>9999 then
    score1-=9999
    score2+=1
  end

[ Continue Reading.. ]

5
5 comments


Hello, i'm coding a character movement but it don't work, why ? :(

Code :

function _init()
	hero = {}
	hero.x = 64
	hero.y = 64
end

function _uptade()
	if btn(0) then 
		hero.x = hero.x - 1
	end
	if btn(1) then 
		hero.x = hero.x + 1
	end
end

function _draw()
	cls()
	spr(0,hero.x,hero.y)
end

my character don't move :(

2 comments



A howto about rotating a sprite around its center...
Use left and right arrows to spin the sprite.

84
53 comments


Cart #22763 | 2016-06-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Cart #22751 | 2016-06-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Pico Cup
Pico Cup is a game about European football/soccer. Do penalty kicks and shoot goals. Hear the crowd cheer. You're the player. The fate of the team depends on you. Don't fail and make your favorite team win the cup.

Controls
Arrows - select options, kick ball
Z - kick ball up-left
X - kick ball up-right, accept team selection

[ Continue Reading.. ]

2
2 comments


Hi, for a game I'm working on, you can choose between two characters. But I dont have enough space to store the two characters in the same cart. I was thinking about releasing two carts, each one with a character.

The issue is that a given thread in the BBS only show the most recent cart in the "splore" of Pico 8.
Do I need to make two separate threads then ? Or is there a way to show or choose what cart is shown in splore ?

I could also try a multiple cartridge thing, like with a main cart with a selection menu, and two cart for the characters. But I dont think it work in web player or in splore. You would need to download the 3 carts manualy.

Is there a better idea than two separate threads ?

4 comments


Cart #22711 | 2016-06-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
42

Accidentally found a fun wavy transition effect while screwing around with math.

I added nice comments to the source. Try pulling it down and tweaking the values to see if you can make it even cuter-looking.

--timer
t=0

function _update()
 --increase timer
 t+=0.05
end

function _draw()
 cls()

 --this crazy bit loops through
 --limited background colors,
 --and changes it when the
 --screen is covered with white
 local c = 12 + ((t-2.55)/4)%4
 rectfill(0,0,128,128,c)

 for i=0,8 do -- column loop
  for j=0,8 do -- row loop
  	--x positions are snapped
  	--to 16px columns
  	local x = i*16

  	--this number sweeps back
  	--and forth from -1 to 1
  	local osc1 = sin(t+i*0.1)

  	--this number also sweeps
  	--back and forth, but at
  	--a different rate
  	local osc2 = sin(t/4+j*0.03)

  	--y positions are influenced
  	--by one of the sweepy
  	--numbers
  	local y = j*16 + osc1*10

  	--the circles' radii are
  	--influenced by the other
  	--sweepy number
   circfill(x, y, osc2*15, 7)
  end
 end
end
42
2 comments






[ Continue Reading.. ]

125
58 comments


Cart #23099 | 2016-06-18 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
11

11
5 comments


Cart #22664 | 2016-06-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

2-player Pong game. I made this so that it can be enjoyable on Pocket CHIP.

Controls

[Left Player]
arrow up / arrow down

[Right Player]
z/x
or
e/d (P2: arrow up / arrow down)

Updates

v.0.2

  • Modified paddle length and ball speed
  • Added screen shake

Older Carts

Cart #22660 | 2016-06-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

4
1 comment





Hold Z to grow old 👴🏼

83
16 comments


Is it possible, to modify the speed of the (keyboard) cursor if you hold one key down.? I think it is too slow and I want to tweak it, to let the cursor move at a higher speed. This might be something for the config.txt.

1
9 comments


Since P8 has a 32k limit on numbers, what's the best way (or a way) to have numbers in the 100 thousands or millions and so on?

I mean, I guess I could super fake it by just printing out zeros after a low score integer but is that really the best way to deal with it?

14
30 comments


Cart #22591 | 2016-06-10 | Code ▽ | Embed ▽ | No License
15

Oh no! There's been a disaster, and your crew has gotten lost at sea. Luckily, you've got a supremely buoyant sailboat: it's up to you to pick them up and tow them back to safety!

Controls:
-Arrows for movement
-Z to toggle UI
-X to swap palettes

I went with some extra self-imposed challenges on this one:
-1-bit colour
-No text
-No assets (i.e. sprites, tiles, sounds, or music)

Made for #simplejam.

15
3 comments




This is a set of sprites and functions that allow the user to draw text with a proportional font. The font covers upper and lowercase, digits and basic punctuation. This set is not as compact as the others right now, demanding 16 sprites, but it provides, IMO, more readable characters.

current version:

  • switched from using the bottom 16 sprites in the first page to a 4x4 area in the first page
  • restored all characters to their intended designs
    old versions:


  • with some heavy optimization and small sacrifices, shrunk the font down to 16 sprites.
  • fixed the colon/semicolon

  • added digits and equal sign


5
3 comments


Cart #22727 | 2016-06-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
10

UPDATE: (0.2) Updated the mouse library so that the cursor can be driven by the gamepad OR the mouse at any time, to make the cart compatible with all Pico-8 devices.

I'm cobbling together a UI/mouse library for my own use, and thought it might be useful to others. For now the only widget is a button, but I wrote the API so that it's easy to modify and extend (in theory). Will provide more documentation if there's interest.

This would be a quick "hello world" with the library, for instance:

--button "onclick" callback
function hideme(this)
 this.visible=false
end

function _init()
 --enable the mouse and
 --set the cursor to a 6x6 sprite 
 --at index 0
 mouse_init(0,6,6)

 --create a new parent UI and
 --make it the active one
 mainui = ui_make()
 ui_setactive(mainui)

 --make a button labeled "hello, world!" 
 --which calls hideme() when clicked.
 --It will draw at screen position (30,30).
 --I could also optionally specify a width and height,
 --but if I leave it out the button will be sized automatically
 --based on the length of the label text.
 btn_make(mainui, "hello, world!", hideme, 30, 30)
end

function _update()
 --update mouse position and do event callbacks
 --as needed
 mouse_update()
end

function _draw()
 cls()

 --print mouse position
 print(mouse.x.." "..mouse.y,0,0,7)

 -- draw mouse on top of UI
 ui_draw()
 mouse_draw()
end

[ Continue Reading.. ]

10
6 comments




Top    Load More Posts ->