Added Dungeon Crawler

This commit is contained in:
Gabriel Mauger authored and GitHub committed 2022-04-22 17:21:05 -06:00
1 parent 6a69540746
commit 5665f4ed9b
1 file changed
+450
+450
View File
@@ -0,0 +1,450 @@
pico-8 cartridge // http://www.pico-8.com
version 33
__lua__
--init
//iteration management
iter=0
function _init()
pl_x=2
pl_y=0
pl_d=0 //n=0,w=1,s=2,e=3
cl=0
cl_end=20
cl_on=true
move=true
show_char=false
show_star=false
key=false
iter+=1
//dialogue_crap
dialogue1={
{{'','',''},{'this is dialogue','',''}},
{{'','',''},{'','',''}},
{{'','',''},{'you just lost the game','',''}}
}
//shooting stars
stars={}
warp_factor=5
for j=1,100 do
local s={
x=rnd(128),
y=rnd(128),
z=1
}
add(stars,s)
end
end
function _update60()
o1 = flr(rnd(0x1f00)) + 0x6040
o2 = o1 + flr(rnd(0x4)-0x2)
len = flr(rnd(0x40))
memcpy(o1,o2,len)
//forward movement
if (btnp(⬆️) and pl_d==0 and move) then
pl_y+=1
end
if (btnp(⬆️) and pl_d==1 and move) then
pl_x+=1
end
if (btnp(⬆️) and pl_d==2 and move) then
pl_y-=1
end
if (btnp(⬆️) and pl_d==3 and move) then
pl_x-=1
end
//turning
if (btnp(➡️)) then
if (pl_d>=3) then pl_d=0
else pl_d+=1 end
end
if (btnp(⬅️)) then
if (pl_d<=0) then pl_d=3
else pl_d-=1 end
end
//clock
cl+=1
if (cl==cl_end) then
cl=0
if cl_on then cl_on=false
else cl_on=true end
end
//show character
if (btnp(❎)) then
show_char= not show_char
if (pl_y==3 and abs(pl_d)%4==3) then
show_star= not show_star
end
end
-- move stars
for s in all(stars) do
-- move star, based on z-order depth
s.x-=s.z*warp_factor/10
if s.x<0 then
s.x=128
s.y=rnd(128)
end
end
end
-->8
--draw--
function _draw()
drawwall()
if show_star then
star_spawn()
end
end
function coord()
print("x:",2,2,7)
print(pl_x,10,2)
print("y:",2,8)
print(pl_y,10,8)
print("d:",2,16)
print(pl_d,10,16)
end
-->8
--walls--
function drawwall()
pl_dd=abs(pl_d)%4
if (pl_y==0 and pl_dd==0) nwall0()
if (pl_y==1 and pl_dd==0) nwall1()
if (pl_y==2 and pl_dd==0) nwall2()
if (pl_y==3 and pl_dd==0) nwall_end()
if (pl_dd==2) then
if (pl_y==3) swall_end()
if (pl_y==2) swall2()
if (pl_y==1) swall1()
end
if ((pl_dd==1 or pl_dd==3) and pl_y<3) then
showdoor()
print(((pl_d-1)/2)+((pl_y+1)*2)+99,58,57,0)
end
if (pl_y==3 and (pl_dd==1 or pl_dd==3)) then
side_ways(pl_dd)
end
if (pl_d%4==2 and pl_y==0) then
showdoor()
print("home",57,57,0)
end
ar_left()
ar_right()
if move then ar_up() end
coord()
end
function swall1()
move=true
cls()
map(64,0,0,0,128,128)
rect(53,54,67,86,7)
rectfill(58,60,62,61,6)
end
function swall2()
move=true
cls()
map(48,0,0,0,128,128)
spr(5,44,56,2,2,false)
spr(32,59,56,1,1,false)
spr(32,59,64,1,1,false)
rect(52,62,55,70,7)
end
function swall_end()
move=true
cls()
map(48,0,0,0,128,128)
spr(1,48,56,1,1,true)
spr(49,48,64,1,1,true)
spr(50,56,56,1,1,true)
spr(2,56,64,1,1,true)
rectfill(51,67,52,63,7)
end
function nwall0()
move=true
cls()
map(0,0,0,0,128,128)
spr(1,72,56,1,1)
spr(49,72,64,1,1)
spr(50,64,56,1,1)
spr(2,64,64,1,1)
end
function nwall1()
move=true
cls()
map(0,0,0,0,128,128)
rect(64,55,81,72)
rectfill(65,56,80,71,0)
end
function nwall2()
move=true
cls()
map(16,0,0,0,128,128)
end
function nwall_end()
move=false
cls()
line(0,10,128,10,7)
line(0,118,128,118)
end
function side_ways(l_or_r)
cls()
line(0,0,128,128,7)
rect(28,28,100,100)
line(0,128,128,0)
rectfill(29,29,99,99,0)
if (l_or_r==3) then
circ(64,54,8,7)
circ(64,54,10,7)
if show_char then
if show_star then
star_spawn()
end
end
end
if (l_or_r==1) then
rect(52,48,76,100,7)
rect(54,50,74,100)
insp()
end
end
function showdoor()
move=false
cls()
map(32,0,0,0,128,128)
npc(pl_y,pl_dd,iter)
end
-->8
--clock_work
function ar_left()
if cl_on then
spr(13,5,60)
else
spr(13,6,60)
end
end
function ar_right()
if cl_on then
spr(13,113,60,1,1,true)
else
spr(13,112,60,1,1,true)
end
end
function ar_up()
if cl_on then
spr(29,60,112)
else
spr(29,60,113)
end
end
function insp()
rectfill(111,112,120,121,0)
if cl_on then
spr(14,112,112)
else
spr(14,112,113)
end
end
function star_spawn()
cls()
for s in all(stars) do
pset(s.x,s.y,7)
end
end
-->8
--npcs
function npc(y,d,i)
insp()
if show_char then
rectfill(0,90,128,128,0)
line(0,90,128,90,7)
line(0,92,128,92)
if(y==0 and d==3 and i!=3) spr(146,56,65,2,3)
if(y==1 and d==1 and i!=3) spr(150,56,65,2,3)
if(y==1 and d==3 and i!=3) spr(164,56,74,2,3)
if(y==2 and d==3 and i!=3) spr(144,56,65,2,3)
print(dialogue1[y+1][((d-1)/2)+1][i],4,96)
else rectfill(56,56,71,63,6)
end
end
__gfx__
00000000000000000000000000000770000000000007000000000000000000000000000070000000000000000000000000000000000000000007700000000000
00000000000000000000000000007000000000000007777777777777000000000000000000000000000000000000007700000000007000000777777000000000
00700700000000070000000000770000000000000007000000000000000000000000000000000000000000000000070000077000077777707707707700000000
00077000700000070000000007000000000000000007000000000000000000000000000000000000000000000007700000700700777777707770077700000000
00077000777777770000000770000000000000000007000000000000000000000000000000000000000000000070000000700700677777707707707700000000
00700700700000070000007000000000000000000007000000000000000000000000000000000000000000007700000000700700067666606777777600000000
00000000700000070000770000000000700000000007000000000000000000070000000000000000000000070000000000700700006000000667766000000000
00000000700000070007000000000000070000000007000000000000000000700000000000000000000007700000000000700700000000000006600000000000
77777777000000000770000000000000070000000007000000000000000000700000000000000000000070000000000000777700000770000000000000000000
00000000000000007000000000000000007000000007000000000000000007000000000000000000007700000000000007700770007777000000000000000000
00000000000000770000000000000000000700000007000000000000000070000000000000000000070000000000000007777770077777700000000000000000
00000000000007000000000000000000000700000007000000000000000070000000000000000007700000000000000000077000067777600000000000000000
00000000000770000000000000000000000070000007000000000000000700000000000000000070000000000000000000077700007777000000000000000000
00000000007000000000000000000000000007000007000000000000007000000000000000007700000000000000000000077000007777000000000000000000
00000000770000000000000000000000000007000007777777777777007000000000000000070000000000000000000000077700006666000000000000000000
00000000000000000000000000000007000000700007000000000000070000000000000007700000000000000000000000000000000000000000000000000000
07000000000000000000000000000007000000070000000000000000700000000000700007700000000000000000000000007000777770000000777700000000
07000000770000000000000000000000000000070000000000000000700000000000700000070000000000000000000000007000000070000000700000000000
07000000007000000000000000000000000000007000000000000007000000000000700000007700000000000000000000007000000070000000700000000000
07000000000770000000000000000000000000000700000000000070000000000000700000000070000000000000000000007000000070000000700000000000
07000000000007000000000000000000000000000700000000000070000000000000700000000007700000000000000000007000000070000000700000000000
07000000000000770000000000000000000000000070000000000700000000000000700000000000070000000000000000007000000070000000700000000000
07000000000000007000000000000000000000000007000000007000000000007777700000000000007700000000000000007000000070000000700000000000
07000000000000000770000000000000000000000007000000007000000000000000700000000000000070000000000000007000000070000000700000000000
00000007700000070007000000000000000000070000700000070000000070007777700000000000000007700000000000000000000070000000000000000000
00000007700000070000770000000000000000070000070000700000000070000000700000000000000000070000000000000000000070000000000000000000
00000007700000070000007000000000000000070000070000700000000070000000700000000000000000007700000000000000000070000000000000000000
00000007777777770000000770000000000000070000007007000000000070000000700000000000000000000070000000000000000070000000000000000000
00000007700000070000000007000000000000070000000770000000000070000000700000000000000000000007700000000000000070000000000000000000
00000007000000070000000000770000000000700000000770000000000070000000070000000000000000000000070000000000000070000000000000000000
00000007000000000000000000007000000077000000000000000000000070000000070000000000000000000000007700000000000077770000000000000000
00000007000000000000000000000770000700000000000000000000000070000000007070000000000000000000000000000000000070000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000007777777777000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000070000000000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707777777777070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707777777777070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707777777777070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000707000000007070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000077700000000000000000000000000000000007000000000070700000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000077777770000000700000707070000007707777000000000000000000000000000000000000000000000000000000000000000000000
00000777770000000000700077707700000700000000000000077070700770000000000000000000000000000000000000000000000000000000000000000000
00077707077770000000777777777770077077007707077000707707077007000000000000000000000000000000000000000000000000000000000000000000
00770070707077000000777777707000000700000000000000077777770770700000000000000000000000000000000000000000000000000000000000000000
07707770707707700007777000707000000700000707070000770770777077770000000000000000000000000000000000000000000000000000000000000000
07070707700770070007700070070700000000000007000000707077070707070000000000000000000000000000000000000000000000000000000000000000
07007770770777000077070707070700000000000000000000707077077707070000000000000000000000000000000000000000000000000000000000000000
07070077707007700077770707070700000000000000000000707070077077070000000000000000000000000000000000000000000000000000000000000000
07070777707077700070707070770000000000000707000000777077077077070000000000000000000000000000000000000000000000000000000000000000
07077777707777700070777777770000000070077070700000770007777770700000000000000000000000000000000000000000000000000000000000000000
07707770770777070070777777777000007707077070700000077700777770700000000000000000000000000000000000000000000000000000000000000000
07770070777007700077077700000000070777777770077000077777777770700000000000000000000000000000000000000000000000000000000000000000
00777707770777700007707777770000077777777777777000070707707000700000000000000000000000000000000000000000000000000000000000000000
00777077777077700007700777707000707770077007770700707070070707000000000000000000000000000000000000000000000000000000000000000000
00777700000777000000707007007000777707700770777700707707707707700000000000000000000000000000000000000000000000000000000000000000
00077077777770000000007770700000707777777777770700777070077070700000000000000000000000000000000000000000000000000000000000000000
00707777777700000000000070700000077707000077077000077070077707000000000000000000000000000000000000000000000000000000000000000000
00770007770070000000777777770000077777777777777007700777770777000000000000000000000000000000000000000000000000000000000000000000
07007000000070000000700700077000007777777777770007070700007770000000000000000000000000000000000000000000000000000000000000000000
77000770000707700007700077707000000777777777700007777077000707000000000000000000000000000000000000000000000000000000000000000000
70000007777000700007000070707000000007700770000000707700077770000000000000000000000000000000000000000000000000000000000000000000
70000007070000700007000707077000000077077077000000070777777070000000000000000000000000000000000000000000000000000000000000000000
70000000070000770007000707007000000770007007700000070700770707000000000000000000000000000000000000000000000000000000000000000000
__map__
0000000000000000000000000000170000000000000000000000000000001700000000000000000000000000000000000014000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3300000000000000000000000026270021220000000000000000000000262700000000000000000000000000000000000024250000000000000000000000001900242500000000000000000000000019000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
232122000000000000000000073600000032330000000000000000000736000000000000000000000000000000000000000035040000000000000000000a0b09000035040000000000000000000a0b09000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000032330000000000000000170000000000232122000000000000001700000000000000000000000000000000000000000000140000000000000000191a0000000000140000000000000000191a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000232122000000000026270000000000000032330000000000262700000000000000606161616161616200000000000000242500000000000a0b09000000000000242500000000000a0b09000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000032330000000736000000000000000000301616161616280000000000000000700000000000007200000000000000003504000000191a0000000000000000002e10101010102d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000232122001700000000000000000000300000000000370000000000000000700000000000007200000000000000000014000a0b09000000000000000000003700000000002c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000270000000000000000000030000000000037000000000000000070000000000000720000000000000000002400000000000000000000000000003700000000002c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000040000000000000000000030000000000037000000000000000070000000000000720000000000000000000700000000000000000000000000003700000000002c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000131112001400000000000000000000300000000000370000000000000000700000000000007200000000000000000017003a3b39000000000000000000003700000000002c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000002030000002425000000000000000000341010101010380000000000000000700000000000007200000000000000002627000000292a0000000000000000003d1616161616280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000131112000000000035040000000000001311120000000000242500000000000000700000000000007200000000000000073600000000003a3b39000000000000073600000000003a3b39000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000002030000000000000000140000000000020300000000000000003504000000000000700000000000007200000000000000170000000000000000292a0000000000170000000000000000292a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
131112000000000000000000242500001311120000000000000000000014000000000000700000000000007200000000000026270000000000000000003a3b39000026270000000000000000003a3b39000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0300000000000000000000000035040003000000000000000000000000242500000000007000000000000072000000000007360000000000000000000000002900073600000000000000000000000029000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000140000000000000000000000000000003500000000007000000000000072000000000017000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0024250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000350400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000002425000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000035040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000026270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000736000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000001700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000262700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0007360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0017000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000