diff --git a/moonbus.p8 b/moonbus.p8 index a1e1da5..011b451 100644 --- a/moonbus.p8 +++ b/moonbus.p8 @@ -17,6 +17,7 @@ function reset() plr_transed=0 plr_money=0 plr_target={x=8,y=2} + plr_level=1 telem_spd={} @@ -92,9 +93,12 @@ function _update() -- crash detection 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 - 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 target=dist(plr_pos,plr_target)<=1 local solid=fget(pmaps,0) @@ -139,9 +143,10 @@ function _draw() cls() camera(cam.x,cam.y) - map(0, 0, 0, 128-maph*8) - map(0, 0, -128*8, 128-maph*8) - map(0, 0, 128*8, 128-maph*8) + local lvl=plr_level*maph + map(0,lvl, 0, 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 img=0 @@ -235,8 +240,8 @@ end function next_target() local docks={} for x=0,127 do - for y=0,maph do - local m=mget(x,y) + for y=0,maph-1 do + local m=mget(x,plr_level*maph+y) local dock=fget(m,7) local new=x!=plr_target.x and y!=plr_target.y if dock and new then @@ -355,6 +360,14 @@ __map__ 0012101013000000000000121010101000000000000000000000000000000012101010101013000000000000000000000000000000000000000000000000000011000000000000000000000020212123202123000000000000000000110000121010130000000000000000202122101300000000000000000000000012101300 1210101010130000000012101010101011001100000000110000000000121010101010101010130011000000000012141300000000000000000000000000001110130000000000000000000020212121212123000000000011001210101010101010101300001100000000202121101013000012101300000000001210101013 1010101010101010141010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010212221101010101010 +0000000000000000000012102221212123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000111210102121212123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000002021212121212110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000002021211021101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000001021212121230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000121021102123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000111112101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1010101410101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 __sfx__ 000400002c2501f250132503365036650396503765035650316502f6502c650246501d6501b6501b65019650126500e65010650116500c6500d6500e6500c6500a65007650016500065000000000000000000000 010800000a4500a4500a4503d0502d0503d0502645026050264503d61421630216301d6201c6101a6150000000000000000000000000000000000000000000000000000000000000000000000000000000000000