You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

358 lines
21 KiB
Lua

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

pico-8 cartridge // http://www.pico-8.com
version 33
__lua__
-- escape the pyras
-- by djib
function _init()
initgame()
end
function _update()
updategame()
end
function _draw()
drawgame()
end
-->8
-- guy
function initguy()
guy={
x=flr(game.boardsize/2),
y=flr(game.boardsize/2),
speed=4,
dead=false
}
end
function moveguy()
if (btn()) then
guy.x=max(0,guy.x-guy.speed)
end
if (btn()) then
guy.x=min(game.boardsize,guy.x+guy.speed)
end
if (btn()) then
guy.y=max(0,guy.y-guy.speed)
end
if (btn()) then
guy.y=min(game.boardsize,guy.y+guy.speed)
end
end
function drawguy()
local spd=guy.speed
drawpixel(guy.x,guy.y,11)
guides={
{guy.x-spd,guy.y-spd},
{guy.x ,guy.y-spd},
{guy.x+spd,guy.y-spd},
{guy.x-spd,guy.y },
{guy.x+spd,guy.y },
{guy.x-spd,guy.y+spd},
{guy.x ,guy.y+spd},
{guy.x+spd,guy.y+spd}
}
for g in all(guides) do
drawpixel(g[1],g[2],6)
end
end
-->8
-- pyras
function initpyras()
pyras={}
for i=1,game.nbpyras do
repeat
pyras[i]={
x=flr(rnd(game.boardsize+1)),
y=flr(rnd(game.boardsize+1))
}
until abs(pyras[i].x-guy.x)>5
or abs(pyras[i].y-guy.y)>5
end
end
function movepyras()
for pyra in all(pyras) do
if (pyra.x>guy.x) pyra.x-=1
if (pyra.x<guy.x) pyra.x+=1
if (pyra.y>guy.y) pyra.y-=1
if (pyra.y<guy.y) pyra.y+=1
if pyra.x==guy.x and
pyra.y==guy.y then
guy.dead=true
end
end
end
function drawandeatpyras()
for index,pyra in ipairs(pyras) do
if getpixel(pyra.x,pyra.y)==8 then
sfx(0)
deli(pyras,index)
else
drawpixel(pyra.x,pyra.y,8)
end
end
end
-->8
-- game
game={
level=1,
pixelsize=2
}
function initgame()
local pxs=game.pixelsize
game.boardsize=flr((127-pxs+1)/pxs)
game.slowdown=0.125*pxs
game.state=0
game.tick=0
game.nbpyras=flr(40*1.25^game.level)
initguy()
initpyras()
end
function drawbg()
local offset=1
if(#pyras>9)offset+=1
if(#pyras>99)offset+=1
rectfill(0,0,127,127,1)
print(#pyras,128-4*offset,1,7)
print("l:"..game.level,1,1,7)
end
function waitormove()
if game.tick>min(20,game.slowdown*#pyras) then
moveguy()
movepyras()
game.tick=0
end
end
function updategame()
game.tick+=1
if game.state==0 then
if(btnp())game.state=1
if game.level==1 then
if(btnp()) and game.pixelsize>1 then
game.pixelsize-=1
initgame()
end
if(btnp()) and game.pixelsize<4 then
game.pixelsize+=1
initgame()
end
end
elseif game.state==1 then
waitormove()
if guy.dead then
if game.level>1 then
game.state=3
game.level-=1
else
game.state=4
end
sfx(1)
elseif #pyras==1 then
game.state=2
game.level+=1
sfx(2)
end
elseif game.tick>60 then
_init()
end
end
function drawgame()
cls()
drawbg()
if(game.state>=1)drawguy()
drawandeatpyras()
if game.state==0 then
rect(46,46,80,80,7)
cursor(48,58,7)
print "press ❎"
print "to start"
if game.level==1 then
cursor(30,90,7)
print "⬅️ change size ➡️"
end
elseif game.state>1 then
cursor(46,61,7)
print "game over"
if game.state==2 then
print "level up!"
end
if game.state==3 then
print "level down"
end
if game.state==4 then
print "try again!"
end
end
end
-->8
-- helpers
function drawpixel(x,y,colour)
local size=game.pixelsize
rectfill(
x*size,
y*size,
(x+1)*size-1,
(y+1)*size-1,
colour
)
end
function getpixel(x,y)
local size=game.pixelsize
return pget(
x*size,
y*size
)
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__label__
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111
17181111177711111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111777177717771
17181171171711111111111111111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111117111711171
17111111177711111111118811111111111111111111111111118111111111111111111111111111111111111111111111811111111111111111777117711771
17111171171711111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111711111711171
17771111177711111111111111111111111111111111111111111111811111111111111111111111111111111111111111111111111111111111777177717771
11111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111
11111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111181111111111111111111111111111181111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111181111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111118181111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111118111111111111111111111111111111111111111811111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111811111811111111111111111111811111111111111111111111111111111111111111111111111111111111111111111111111111111188111111
11111118111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811
11111811111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111111111111111
11111111111111111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11118111111111111111111111111111111111111111111111111111111111111111111111111181111111118111111111111111111111111111111118111111
11111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111118111111111
11111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111111111111111111111111111181111111
11111111111181111111111111181111181111111111111111111111118111111111111111181111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111181111111111111111111111111111118111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111811111118111111111111111111111111111111111111111111111111
11118111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111181111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111181111111111111111111111111111811111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11811111111111111111111111111111111811111111111111811111111111111111811111111111111111111111111111111111111111111111111111111111
18111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111811111111111111181111181111111118111
11111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111
11111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111811111111111111111111111111111811111111111111111111111111111111111111111111181111111111111111111111111111111111811111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111118111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111811111111111111181111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118811111111111118118111111111111111
11111111111111111111111111111111111111111111181111111111181118111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111881111111111
11111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111118111111111
11118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111111111111
11181111111111111111111111118111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111811111111
11111111111111111111111111111111111111111811111111111111111161116111611111111111111111111111111111111111111111111181111111111111
11111111111111111111111111111111111111111111111177717771777117711771111117777711111111111111111111111111111111111111111111111111
11111111111111188111111111111111111111111111111171717171711171117111111177171771111111181111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111177717711771177717771111177717778111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111181111117111717171116171b171611177171771111111111111111111111111111111111111111111111111
11111811111111111811111111111111111111111111111171117171777177117711111117777711111111111111111118111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111
11111111111111111181111111111811111111111111111177711771111117717771777177717771111111111111111111111111111111111111111181111111
11111118111111111111111111111111111111111111111117117171111171116711717171711711111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111118111117117171111177711711777177111711111111111111111118111111111111111111111111111111
11111111111111111111111111111111111111111111111117117171111111711711717171711711111111111111111111181111111111111111111111111111
11111111111111118111111111111111111111111111111117117711111177111711717171711711111111111111111111111111111111111111111111111111
11111111111111111111181111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111
11111111111111111111111111111111111111111118111111111811111111111111111111811111111111111111181811111111111111111111111111111111
11111111111111111111111811111111111111111111111111111111111118111111111111111111111111111111111111111181111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111181111111
11111111111181111111111111111111111111111111111111118111111111111111111111111181111111118111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111111
11111111111111111111111111181111111111111111111111111111111111111111111111111181111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111
11111111111111111111111111181111111111111111111111811111111111111111181111111111111111111111811111111111111111111111111111181111
11111811111111181111111111111111111111111111111111111111111111111111111111811111111111111111111111111111118111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111181118
11111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111181111811111111
11111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111118111111111111111111111111111111111111118111111111111111111111111111181111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111181181111111111111111111111111111111111111111111111111111111111111111111111
11111811111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111
11111111111111111111111111111181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111811111111111111111111111111118111111111111111111118111111111111111111111111111111
11111181111111111111111111111111118111111111811111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111
11111111111111111111111111111118111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111811111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111811111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111118111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111111111111111
11111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111118111111111111
11111811111111111111111111111111111111111111111111111111111111111111111111111111111111111111811811111111111111111111111111118111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181811111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111
11111118111111111111111111111111111111811111111111111111111111111111111111111111111118111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111118111111111
11111111111111111111111111111111111811111111111111111111111111111111111111111111111111111111111111118111111111111111111111181111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111
11181111111111111111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111811111111111111
18111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111811111111
11111111111111111111111111111111111111111111811111111111111111111111111181111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111811111111111111111111111111111111111111111111111111811111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111188111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111118111111111111111111111111111111111111111111811111111111111111111111111111111111111
11118111111111111111111111111111118111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
__sfx__
000100002e05000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
9d0800000215000000000001910018100021500000000000021500000002150000000000014100131000515000000121000415000000041500000011100021500000002150000000010001150000000215000100
000d00000c150000000f1500f1501315100000000001115000000000000c15000000000000000000000000000000000000000000a15000000000000c150000000000000000000000000000000000000000000000