moonbus: multiple map levels

This commit is contained in:
Dejvino 2024-08-09 22:38:47 +02:00
parent 0f366ae64a
commit a4045f4f19

View File

@ -17,6 +17,7 @@ function reset()
plr_transed=0 plr_transed=0
plr_money=0 plr_money=0
plr_target={x=8,y=2} plr_target={x=8,y=2}
plr_level=1
telem_spd={} telem_spd={}
@ -92,9 +93,12 @@ function _update()
-- crash detection -- crash detection
local pc=plus(plr_pos,{x=0.5,y=-0.5}) local pc=plus(plr_pos,{x=0.5,y=-0.5})
if pc.y <= maph and not plr_static then if pc.y <= maph+1 and not plr_static then
for p in all({plus(pc,clearx(unit(plr_speed,0.4))), plus(pc,cleary(unit(plr_speed,0.4)))}) do for p in all({plus(pc,clearx(unit(plr_speed,0.4))), plus(pc,cleary(unit(plr_speed,0.4)))}) do
local pmaps=mget(p.x,maph-p.y) local pmaps=0
if (p.y>=0 and p.y<=maph) then
pmaps=mget(p.x,maph-p.y+plr_level*maph)
end
local dock=fget(pmaps,7) local dock=fget(pmaps,7)
local target=dist(plr_pos,plr_target)<=1 local target=dist(plr_pos,plr_target)<=1
local solid=fget(pmaps,0) local solid=fget(pmaps,0)
@ -139,9 +143,10 @@ function _draw()
cls() cls()
camera(cam.x,cam.y) camera(cam.x,cam.y)
map(0, 0, 0, 128-maph*8) local lvl=plr_level*maph
map(0, 0, -128*8, 128-maph*8) map(0,lvl, 0, 128-maph*8)
map(0, 0, 128*8, 128-maph*8) map(0,lvl, -128*8, 128-maph*8)
map(0,lvl, 128*8, 128-maph*8)
local px,py=to_scrn(plr_pos) local px,py=to_scrn(plr_pos)
local img=0 local img=0
@ -235,8 +240,8 @@ end
function next_target() function next_target()
local docks={} local docks={}
for x=0,127 do for x=0,127 do
for y=0,maph do for y=0,maph-1 do
local m=mget(x,y) local m=mget(x,plr_level*maph+y)
local dock=fget(m,7) local dock=fget(m,7)
local new=x!=plr_target.x and y!=plr_target.y local new=x!=plr_target.x and y!=plr_target.y
if dock and new then if dock and new then
@ -355,6 +360,14 @@ __map__
0012101013000000000000121010101000000000000000000000000000000012101010101013000000000000000000000000000000000000000000000000000011000000000000000000000020212123202123000000000000000000110000121010130000000000000000202122101300000000000000000000000012101300 0012101013000000000000121010101000000000000000000000000000000012101010101013000000000000000000000000000000000000000000000000000011000000000000000000000020212123202123000000000000000000110000121010130000000000000000202122101300000000000000000000000012101300
1210101010130000000012101010101011001100000000110000000000121010101010101010130011000000000012141300000000000000000000000000001110130000000000000000000020212121212123000000000011001210101010101010101300001100000000202121101013000012101300000000001210101013 1210101010130000000012101010101011001100000000110000000000121010101010101010130011000000000012141300000000000000000000000000001110130000000000000000000020212121212123000000000011001210101010101010101300001100000000202121101013000012101300000000001210101013
1010101010101010141010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010212221101010101010 1010101010101010141010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010212221101010101010
0000000000000000000012102221212123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000111210102121212123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000002021212121212110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000002021211021101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000001021212121230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000121021102123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000111112101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1010101410101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010
__sfx__ __sfx__
000400002c2501f250132503365036650396503765035650316502f6502c650246501d6501b6501b65019650126500e65010650116500c6500d6500e6500c6500a65007650016500065000000000000000000000 000400002c2501f250132503365036650396503765035650316502f6502c650246501d6501b6501b65019650126500e65010650116500c6500d6500e6500c6500a65007650016500065000000000000000000000
010800000a4500a4500a4503d0502d0503d0502645026050264503d61421630216301d6201c6101a6150000000000000000000000000000000000000000000000000000000000000000000000000000000000000 010800000a4500a4500a4503d0502d0503d0502645026050264503d61421630216301d6201c6101a6150000000000000000000000000000000000000000000000000000000000000000000000000000000000000