From abd6e5b498c37dd6d9f5408ee495362bdf473742 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sun, 1 Jan 2023 19:17:20 -0800 Subject: [PATCH] Fix misc rope bugs --- chameleonic.p8 | 59 +++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/chameleonic.p8 b/chameleonic.p8 index 6553ef9..94da5ee 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -274,7 +274,7 @@ function title:draw() print(lvlstr,51,90,blinkcol) end -start_level=0 +start_level=24 max_level=31 function title:update() @@ -1579,7 +1579,12 @@ function rope:_calc_push( local ops={} if (not an) return ops - if a0.x==a1.x then + local ax0,ay0=_anch_unpack(a0) + local ax1,ay1=_anch_unpack(a1) + + local anch=level:anchor_at(a0) + + if ax0==ax1 then -- no far side applying pressure? local y0,y1=_mnmx(a0.y,a1.y) local my0,my1,smy=(y0+1)\8,(y1-1)\8,1 @@ -1589,13 +1594,13 @@ function rope:_calc_push( end local mx,dmx - if a0.x%8==0 and a0.x>an.x+7 then + if anch.adx==-1 and a0.x>an.x+7 then -- push left - mx=(a0.x-1)\8 + mx=ax0-1 dmx=-1 - elseif a0.x%8==7 and a0.xa1.x then @@ -1615,14 +1620,14 @@ function rope:_calc_push( end local my,dmy - if a0.y%8==0 and a0.y>an.y+6 then + if anch.ady==-1 and a0.y>an.y+6 then -- push up - my=(a0.y-1)\8 + my=ay0-1 dmy=-1 - elseif a0.y%8==7 and a0.y