forked from pyrex/chameleonic
Shorten rope drawing code
This commit is contained in:
parent
95e5b3d0bf
commit
4987e71deb
@ -958,16 +958,18 @@ function rope:draw(artificial_px,artificial_py)
|
|||||||
|
|
||||||
if from_end then
|
if from_end then
|
||||||
x,y=x+dx-dx*coef,y+dy-dy*coef
|
x,y=x+dx-dx*coef,y+dy-dy*coef
|
||||||
dx,dy=dx*coef,dy*coef
|
|
||||||
else
|
|
||||||
dx,dy=dx*coef,dy*coef
|
|
||||||
end
|
end
|
||||||
|
dx,dy=dx*coef,dy*coef
|
||||||
|
|
||||||
colorh(i)
|
colorh(i)
|
||||||
|
|
||||||
linefill(x,y,x+0.25*dx,y+0.25*dy,1.0)
|
local function lf(d0,d1,w)
|
||||||
linefill(x+0.25*dx,y+0.25*dy,x+1*dx,y+1*dy,0.5)
|
linefill(x+d0*dx,y+d0*dy,x+d1*dx,y+d1*dy,w)
|
||||||
linefill(x+0.9*dx,y+0.9*dy,x+dx,y+dy,1.0)
|
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)
|
circfill(x+dx+0.5,y+dy+0.5,1.0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user