Shorten rope drawing code

This commit is contained in:
Pyrex 2022-12-30 23:09:38 -08:00
parent 95e5b3d0bf
commit 4987e71deb

View File

@ -958,16 +958,18 @@ function rope:draw(artificial_px,artificial_py)
if from_end then
x,y=x+dx-dx*coef,y+dy-dy*coef
dx,dy=dx*coef,dy*coef
else
dx,dy=dx*coef,dy*coef
end
dx,dy=dx*coef,dy*coef
colorh(i)
linefill(x,y,x+0.25*dx,y+0.25*dy,1.0)
linefill(x+0.25*dx,y+0.25*dy,x+1*dx,y+1*dy,0.5)
linefill(x+0.9*dx,y+0.9*dy,x+dx,y+dy,1.0)
local function lf(d0,d1,w)
linefill(x+d0*dx,y+d0*dy,x+d1*dx,y+d1*dy,w)
end
lf(0,0.25,1.0)
lf(0.25,1,0.5)
lf(0.9,1,1.0)
circfill(x+dx+0.5,y+dy+0.5,1.0)
end
end