diff --git a/chameleonic.p8 b/chameleonic.p8 index 662ba2a..f2e71f0 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -1521,9 +1521,10 @@ function rope:_calc_push( local ops={} if (an==nil) return ops local pull_ang=atan2( - a0.x\8 - an.x\8, + a0.x\8-an.x\8, a0.y\8-an.y\8 ) + local needs_good_pull=af==nil if a0.x==a1.x then -- no far side applying pressure? @@ -1536,15 +1537,15 @@ function rope:_calc_push( local mx,dmx if a0.x%8==0 and a0.x>an.x+7 then - local needs_good_pull=af==nil or af.x>=a1.x - if (needs_good_pull and _ang_diff(pull_ang,0.5)>=0.125) return {} + needs_good_pull=needs_good_pull or af.x>=a1.x + if (needs_good_pull and _ang_diff(pull_ang,0.0)>=0.125) return {} -- push left mx=(a0.x-1)\8 dmx=-1 elseif a0.x%8==7 and a0.x=0.125) return {} + needs_good_pull=needs_good_pull or af.x<=a1.x + if (needs_good_pull and _ang_diff(pull_ang,0.5)>=0.125) return {} -- push right mx=(a0.x+1)\8 @@ -1568,7 +1569,7 @@ function rope:_calc_push( local my,dmy if a0.y%8==0 and a0.y>an.y+6 then - local needs_good_pull=af==nil or af.x>=a1.x + needs_good_pull=needs_good_pull or af.y>=a1.y if (needs_good_pull and _ang_diff(pull_ang,0.75)>=0.125) return {} -- push up @@ -1576,7 +1577,7 @@ function rope:_calc_push( dmy=-1 elseif a0.y%8==7 and a0.y=a1.x + needs_good_pull=needs_good_pull or af.y<=a1.y if (needs_good_pull and _ang_diff(pull_ang,0.25)>=0.125) return {} -- push down