Last active
May 11, 2023 01:00
-
-
Save Pinball3D/f3ea03b7ef07ee44c17b565ffaed911e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pico-8 cartridge // http://www.pico-8.com | |
| version 41 | |
| __lua__ | |
| x=50 | |
| y=48 | |
| mapx=255 | |
| target=0 | |
| msgtime=0 | |
| level=1 | |
| title, m = "", "" | |
| colisions = {} | |
| gameover=false | |
| lives=5 | |
| back1=0 | |
| back2=128 | |
| //player customizer | |
| pc=true | |
| //#1 is 0 or 1 | |
| p={1,0,0,0,0,0} | |
| tab=1 | |
| sel=0 | |
| //timer | |
| t = 90 | |
| //bosses | |
| //list of lists. | |
| //[period, x, spr#] | |
| bosses={{2,30, 74},{1,26,70}} | |
| function _init() | |
| for i=0, 10 do//flr(rnd(70)) do | |
| local spri = 64+flr(rnd(10)) | |
| if(spri % 2 != 0)then | |
| spri=spri+1 | |
| end | |
| add(bosses, {flr(rnd(7)), rnd(128), spri}) | |
| end | |
| end | |
| function _update() | |
| if(pc) then | |
| //player editor | |
| if(btnp(1)) then | |
| if(sel==0) then | |
| if(tab != 6) then | |
| tab=tab+1 | |
| end | |
| else | |
| if(p[tab]<(tab==1 and 1 or 15))then | |
| p[tab]=p[tab]+1 | |
| end | |
| end | |
| end | |
| if(btnp(0)) then | |
| if(sel==0) then | |
| if(tab != 1) then | |
| tab=tab-1 | |
| end | |
| else | |
| if(p[tab]>0)then | |
| p[tab]=p[tab]-1 | |
| end | |
| end | |
| end | |
| if(btnp(2)) then | |
| if(sel==1) then | |
| sel=0 | |
| end | |
| end | |
| if(btnp(3)) then | |
| if(sel==0) then | |
| sel=1 | |
| end | |
| end | |
| if(btn(4))then | |
| pc=false | |
| end | |
| else | |
| if(gameover==false)then | |
| //background | |
| if(back2<=-128) then back2=128 end | |
| if(back1<=-128) then back1=128 end | |
| back1=back1-1 | |
| back2=back2-1 | |
| //timer | |
| t=t-1/30 | |
| //colisions | |
| for b=1, #bosses do | |
| local boss = bosses[b] | |
| if(boss[1]==level) then | |
| if(boss[2]+mapx==x)then | |
| if(y>=48)then | |
| gameover=true | |
| end | |
| end | |
| end | |
| end | |
| //jump | |
| if(msgtime>0) then msgtime=msgtime-0.05 end | |
| if(btnp(2)) then | |
| target=y-30 | |
| end | |
| //map move | |
| if(mapx<=-128)then | |
| mapx=256 | |
| end | |
| if(mapx==256)then | |
| level=level+1 | |
| end | |
| mapx=mapx-1 | |
| //player | |
| if(target!=0) then | |
| y=y-(0.3*(y-target)) | |
| end | |
| if(target>=flr(y))then target=0 end | |
| if(target==0) then | |
| y=y+(0.1*(49-y)) | |
| end | |
| if (y>48) then | |
| y=48 | |
| end | |
| end | |
| end | |
| end | |
| function _draw() | |
| cls() | |
| if(pc) then | |
| //player selector | |
| cls(5) | |
| print("press z to save",64-#"press z to save"*2,122,6) | |
| print("character editor",32,1,6) | |
| player(56,20,p[1],p[2],p[3],p[4],p[5],p[6]) | |
| //tabs | |
| for i=0,8 do | |
| if(tab-1 !=i) then | |
| spr(137,16*i,40,2,2,false,false) | |
| end | |
| end | |
| spr(135,16*(tab-1),40,2,2,false,false) | |
| //tabicons | |
| spr(132,4,44,1,1,false,false) | |
| spr(148,20,44,1,1,false,false) | |
| spr(133,36,44,1,1,false,false) | |
| spr(149,52,44,1,1,false,false) | |
| spr(134,68,44,1,1,false,false) | |
| spr(150,84,44,1,1,false,false) | |
| //colors | |
| if(tab!=1)then | |
| for r=0,1 do | |
| for c=0,7 do | |
| //x,y,x,y,col | |
| rectfill(15+12*c,64+12*r,23+12*c,72+12*r,c+8*r) | |
| end | |
| end | |
| else | |
| for c=0,1 do | |
| rectfill(15+12*c,64,23+12*c,72,c*11+4) | |
| end | |
| end | |
| //cursor | |
| local c = p[tab]-flr(p[tab]/8)*9 | |
| local r = flr(p[tab]/8) | |
| rect(15+12*c+12*r,64+12*r,23+12*c+12*r,72+12*r,7) | |
| else | |
| //map | |
| palt(0, false) | |
| map(0, 9, back1, 8, 16, 8) | |
| map(0, 9, back2, 8, 16, 8) | |
| map(16*(level-1), 0, mapx, 0, 16, 9) | |
| //period text | |
| if(mapx>=128)then | |
| local pt = "period "..level | |
| rectfill(64-#pt*2-4, 34,64+#pt*2+2, 46, 0) | |
| print(pt,64-#pt*2,38,7) | |
| end | |
| palt(0, true) | |
| //time | |
| local mins = tostr(flr(flr(t)/60)) | |
| local secs = tostr(flr(t)-60*flr(flr(t)/60)) | |
| if(#secs==1)then secs="0"..secs end | |
| print(mins..":"..secs,1,1, 7) | |
| //lives | |
| hearts(lives) | |
| //player sprite | |
| player(x,y,p[1],p[2],p[3],p[4],p[5],p[6]) | |
| //bosses | |
| for b=1, #bosses do | |
| local boss = bosses[b] | |
| if(boss[1]==level) then | |
| spr(boss[3],boss[2]+mapx,48,2,2,false,false) | |
| end | |
| end | |
| //ui | |
| messagebox() | |
| if(flr(rnd(3000))==flr(rnd(3000))) then | |
| message("miss. lang", "spit out your gum!") | |
| end | |
| if(msgtime>0) then | |
| message(title, m) | |
| end | |
| //game over | |
| if(gameover) then | |
| cls(7) | |
| print("game over") | |
| end | |
| end | |
| end | |
| function message(name, message) | |
| print(name, 6, 80) | |
| print(message, 6, 88) | |
| print(flr(msgtime), 118, 80) | |
| title=name | |
| m=message | |
| if(msgtime<=0) then | |
| msgtime=10 | |
| end | |
| end | |
| function messagebox() | |
| spr(10,0,74,1,1,false,false) | |
| spr(10,0,120,1,1,false,true) | |
| spr(10,120,120,1,1,true,true) | |
| spr(10,120,74,1,1,true,false) | |
| for c=1, 14 do | |
| spr(11,8*c,74,1,1,false,false) | |
| spr(11,8*c,120,1,1,false,true) | |
| end | |
| for c=1,5 do | |
| spr(26,120,74+8*c,1,1,true,true) | |
| spr(26,0,74+8*c,1,1,false,true) | |
| end | |
| end | |
| function hearts(l) | |
| local s = 128-48 | |
| for c=1, l do | |
| spr(22, s+8*c, 0, 1, 1, false, false) | |
| end | |
| for c=1, flr(5-l) do | |
| spr(21, s+ceil(l)*8+8*c, 0, 1, 1, false, false) | |
| end | |
| if(flr(l)!=l) then | |
| spr(23, s+ceil(l)*8, 0, 1, 1, false, false) | |
| end | |
| end | |
| function player(x,y,b,e,p,s,sh,h) | |
| //body | |
| spr(128+b*2, x, y, 2, 2, false, false) | |
| //eyes | |
| rectfill(x+6,y+2,x+6,y+2, e) | |
| rectfill(x+9,y+2,x+9,y+2, e) | |
| //pants | |
| rectfill(x+5,y+11,x+6,y+14, p) | |
| rectfill(x+9,y+11,x+10,y+14, p) | |
| rectfill(x+6,y+11,x+9,y+12, p) | |
| //shoes | |
| rectfill(x+5,y+15,x+6,y+15, s) | |
| rectfill(x+9,y+15,x+10,y+15, s) | |
| //shirt | |
| rectfill(x+3,y+5,x+6,y+6, sh) | |
| rectfill(x+9,y+5,x+12,y+6, sh) | |
| rectfill(x+5,y+6,x+10,y+10, sh) | |
| //hair | |
| rectfill(x+10,y,x+10,y+1, h) | |
| rectfill(x+5,y,x+10,y, h) | |
| rectfill(x+5,y,x+5,y+1, h) | |
| end | |
| __gfx__ | |
| 00000000000004444440000000000000000000000000000000000000111111116666666666666666000000000000000000000000000000000000700000000000 | |
| 00000000000004ffff40000000000000000000000000000044440444666661666667666666666676000000000000000000000677776000000007970000000000 | |
| 0070070000000fcffcf00000000000000000000055555555444404446666616666766666666667660000cccccccccccc00677777777776000007a70000000000 | |
| 0007700000000ffffff00000000000000000000056666665000000001111111167666666666676660000c0000000000000555555555555007007a70000000000 | |
| 0007700000000ffffff000000000000000000000566666654044444466616666666666666667666600ccc000000000000005555555555000a77a700000000000 | |
| 007007000008888ff88880000000b00000000000566666654044444466616666666666666676666600c000000000000000075575575570007aa7000000000000 | |
| 0000000000088888888880000008880000000000566666650000000011111111666666666766666600c000000000000000075575575570000770000000000000 | |
| 00000000000ff888888ff0000008880000000000555555554444440466666166666666667666666600c000000000000000075575575570000000000000000000 | |
| 00000000000ff888888ff0004444444444444444077077000770770007707700666666676666666600c000000000000000075575575570000000000000000000 | |
| 00000000000ff888888ff00000f0000000000f00755755707887887078875570666666766666666600c000000000000000075575575570000000000000000000 | |
| 00000000000ff888888ff00000f0000000000f00755555707888887078885570666667666666666600c000000000000000075575575570000000000000000000 | |
| 00000000000ff666666ff00000f0000000000f00755555707888887078885570666676666666666600c000000000000000075575575570000000000000000000 | |
| 00000000000006666660000000f0000000000f00075557000788870007885700666766666666667600c000000000000000075575575570000000000000000000 | |
| 00000000000006600660000000f0000000000f00007570000078700000787000667666666666676600c000000000000000067767767760000000000000000000 | |
| 00000000000006600660000000f0000000000f00000700000007000000070000676666666666766600c000000000000000006666666600000000000000000000 | |
| 00000000000007700770000000f0000000000f00000000000000000000000000666666666666666600c000000000000000000000000000000000000000000000 | |
| 77777767000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 77777767000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 77777767000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 66666666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 77677777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 77677777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 77677777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 66666666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 000044444444000000000000000000000000000000000000000000000000000000000fffff000000000000444000000000000000000000000000000000000000 | |
| 00004ffffff40000000004444400000000000fffff000000000004444400000000000fcfcf000000000000fff000000000000000000000000000000000000000 | |
| 00004fcffcf40000000004fff400000000000f1f1f000000000004ff4400000000000fffff00000000000fcfcf00000000000000000000000000000000000000 | |
| 00004ffffff400000000041f14000000000004fff40000000000041f1400000000000fffff000000000000fff000000000000000000000000000000000000000 | |
| 001111ffff111100000004fff40000000000044444000000000004fff40000000000007f700000000000077f7700000000000000000000000000000000000000 | |
| 0111111111111110000004fff40000000000007f70000000000004fff40000000007777777770000000007787700000000000000000000000000000000000000 | |
| 01111111111111100000011f1100000000077777777700000000088f88000000000777777777000000000f787f00000000000000000000000000000000000000 | |
| 0ff1111111111ff0000001111100000000077777777700000000088888000000000777777777000000000f787f00000000000000000000000000000000000000 | |
| 0ff1111111111ff0000001111100000000077777777700000000081118000000000777777777000000000f777f00000000000000000000000000000000000000 | |
| 0ff1111111111ff0000001111100000000077777777700000000088888000000000777777777000000000f777f00000000000000000000000000000000000000 | |
| 0ffddddddddddff0000001111100000000077666667700000000088888000000000ff11111ff0000000000111000000000000000000000000000000000000000 | |
| 0ff0dddddddd0ff000000f606f000000000ff11111ff000000000fcccf0000000000011011000000000000101000000000000000000000000000000000000000 | |
| 00000dd00dd0000000000060600000000000011011000000000000c0c00000000000011011000000000000101000000000000000000000000000000000000000 | |
| 00000dd00dd0000000000060600000000000011011000000000000c0c00000000000011011000000000000101000000000000000000000000000000000000000 | |
| 00000dd00dd0000000000060600000000000011011000000000000c0c00000000000011011000000000000101000000000000000000000000000000000000000 | |
| 00005ff00ff50000000005f0f50000000000444044400000000005f0f50000000000444044400000000004404400000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000004444000000000000ffff000000000770000770077077700777000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 000004044040000000000f0ff0f00000077777700770077077777777000ccccccccccc0000000000000000000000000000000000000000000000000000000000 | |
| 000004444440000000000ffffff0000000077000077007700777777000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 000004444440000000000ffffff0000000077000077007700777777000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 00000004400000000000000ff000000000077000077007700777777000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000700700077007700777777000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0004400000044000000ff000000ff00007000070000000000777777000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0004400000044000000ff000000ff00000000000000000000000000000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0004400000044000000ff000000ff00000000000000000000000000000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0004400000044000000ff000000ff00000777700000000000000000000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0004400000044000000ff000000ff00007000070000000000000000000c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000070077007000000007777777700c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000007000070000000007777777700c0000000000c0000000000000000000000000000000000000000000000000000000000 | |
| 000000000000000000000000000000000077770000000000770000770c00000000000cc000000000000000000000000000000000000000000000000000000000 | |
| 00000000000000000000000000000000000000000770077077000077c0000000000000cccccccccccccccccc0000000000000000000000000000000000000000 | |
| __map__ | |
| 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000809080908090809080900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000001819181918191819181900000000001818181800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000001818181800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 0606060606060606060607070707070006060707070707070707070706060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 2020202020202020202020202020202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| __sfx__ | |
| 000100000305000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
| 001000000305000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment