From a82e34aeb24fe0219ff45458f90b2453a7932bd3 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sat, 10 Aug 2024 07:56:16 +0200 Subject: [PATCH] moonbus: configurable map levels --- moonbus.p8 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/moonbus.p8 b/moonbus.p8 index ec7979c..3a07e12 100644 --- a/moonbus.p8 +++ b/moonbus.p8 @@ -17,7 +17,13 @@ function reset() plr_transed=0 plr_money=0 plr_target={x=8,y=2} - plr_level=2 + plr_level=3 + + levels={ + {map_start=0,map_height=8}, + {map_start=8,map_height=8}, + {map_start=16,map_height=16} + } telem_spd={} @@ -25,7 +31,8 @@ function reset() engine_power=0.1 fuel_cons=0.005 land_speed_limit=1 - maph=8 + mapy=levels[plr_level].map_start + maph=levels[plr_level].map_height bonus_docked=1 cam={} @@ -97,7 +104,7 @@ function _update() for p in all({plus(pc,clearx(unit(plr_speed,0.4))), plus(pc,cleary(unit(plr_speed,0.4)))}) do local pmaps=0 if (p.y>=0 and p.y<=maph) then - pmaps=mget(p.x,maph-p.y+plr_level*maph) + pmaps=mget(p.x,mapy+maph-p.y) end local dock=fget(pmaps,7) local target=dist(plr_pos,plr_target)<=1 @@ -143,7 +150,7 @@ function _draw() cls() camera(cam.x,cam.y) - local lvl=plr_level*maph + local lvl=mapy map(0,lvl, 0, 128-maph*8) map(0,lvl, -128*8, 128-maph*8) map(0,lvl, 128*8, 128-maph*8) @@ -241,7 +248,7 @@ function next_target() local docks={} for x=0,127 do for y=0,maph-1 do - local m=mget(x,plr_level*maph+y) + local m=mget(x,mapy+y) local dock=fget(m,7) local new=x!=plr_target.x and y!=plr_target.y if dock and new then @@ -376,6 +383,14 @@ __map__ 1300000000162500000000001100000020212223000000000000000000000000000000000000302121222300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1013000000000000000000121013000000000000000000000016000000000000000000000000302121213100000000000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1010130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 __sfx__ 000400002c2501f250132503365036650396503765035650316502f6502c650246501d6501b6501b65019650126500e65010650116500c6500d6500e6500c6500a65007650016500065000000000000000000000 010800000a4500a4500a4503d0502d0503d0502645026050264503d61421630216301d6201c6101a6150000000000000000000000000000000000000000000000000000000000000000000000000000000000000