diff --git a/moonbus.p8 b/moonbus.p8 index 0ec1a16..a1e1da5 100644 --- a/moonbus.p8 +++ b/moonbus.p8 @@ -83,6 +83,7 @@ function _update() -- move objects move(plr_pos,plr_speed,0.1) + plr_pos.x=plr_pos.x%128 -- gravity pull if not plr_static then @@ -139,6 +140,8 @@ function _draw() 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 px,py=to_scrn(plr_pos) local img=0 @@ -164,8 +167,14 @@ function _draw() -- target if plr_alive then - local tx,ty=to_scrn(plr_target) - local dst=dist(plr_pos,plr_target) + local tg={x=plr_target.x,y=plr_target.y} + if plr_target.x-plr_pos.x>64 then + tg.x-=128 + elseif plr_target.x-plr_pos.x<-64 then + tg.x+=128 + end + local tx,ty=to_scrn(tg) + local dst=dist(plr_pos,tg) local c=flr(t())%2==0 and 3 or 11 if dst > 8 then local dir=atan2(tx-px,ty-py)