Someone on Twitter asked for this, and this seemed like the easiest place to share the code.
function preplace_in_circle(centerx,centery,radius,checkcol,newcol)
local topleft={x=centerx-radius,y=centery-radius}
local bottomright={x=centerx+radius,y=centery+radius}
for x=topleft["x"],bottomright["x"] do
for y=topleft["y"],bottomright["y"] do
if (x-centerx)^2+(y-centery)^2<radius^2 then
if (pget(x,y)==checkcol) pset(x,y,newcol)
end
end
end
end |
function psetin_circle(centerx,centery,radius,checkcol,col)
local topleft={x=centerx-radius,y=centery-radius}
local bottomright={x=centerx+radius,y=centery+radius}
for x=topleft["x"],bottomright["x"] do
for y=topleft["y"],bottomright["y"] do
if (x-centerx)^2+(y-centery)^2<radius^2 then
pset(x,y,col)
end
end
end
end |
P#98594 2021-10-13 19:01
[Please log in to post a comment]



