Why is my circle uneven?
Posted: Sat Feb 09, 2019 7:46 pm
I am trying to create a circle of entities. I wrote a function for this:
But my circle is uneven. besides, chests are sometimes placed again in the same position(I identified this as a duplicate shadow).
Orange highlighting - discrepancy
Blue Arrow - Chests x2
Discrepancy none, But duplicate chests are present.
How do i fix this?
Code: Select all
function circle(x,y,r)
local angle = 0
x = x + 0.5 - (x + 0.5) % 1
y = y + 0.5 - (y + 0.5) % 1
r = r + 0.5
while angle < 2*math.pi do
angle = angle + r/r^2
local xs = (x + r * math.cos (angle))
local ys = (y + r * math.sin (angle))
game.surfaces[1].create_entity{name = "wooden-chest", position= {xs,ys},force='player'}
end
end
Code: Select all
/c circle(0,0,15)Blue Arrow - Chests x2
Code: Select all
/c circle(0,0,10)