function createObjectsOnArc(x,y,radius,arc_deg,offset,spacing,object_type,rings,chance,randomize)
if rings == nil then rings = 1 end
if chance == nil then chance = 100 end
if randomize == nil then randomize = 0 end
local circ_dist = 2*math.pi*radius
local arc_dist=(circ_dist/360)*arc_deg
local deg= arc_deg/(arc_dist/spacing)
local randeg=arc_deg/(arc_dist/randomize)
local total_count = (math.floor((arc_deg/deg),0.5)+1)
if total_count>1000 then
spacing = arc_dist/1000
deg= arc_deg/(arc_dist/spacing)
total_count = arc_dist/spacing
end
for cnt=0,total_count,1 do
for cnt_ring=0,rings-1,1 do
local cnt_deg = offset+cnt*deg+(random(-randeg,randeg))
local cnt_dist = radius + (random((-cnt_ring*randomize),(cnt_ring*randomize)))
if random(0, 100) < chance then
local dx,dy = vectorFromAngle(cnt_deg,cnt_dist)
object_type():setPosition(x + dx, y + dy)
end
end
end
end
It looks like you're new here. If you want to get involved, click one of these buttons!