driver.love/0116-spawn_point

14 lines
409 B
Plaintext

spawn_point = function()
Spawn_candidates = {}
for _=1,10 do
local result = {w=600, h=100}
result.x = math.random(Viewport.x, Viewport.x+Viewport.w)
result.x = round(result.x/100)*100
result.y = math.random(Viewport.y, Viewport.y+Viewport.h)
if _ == 10 or not overlaps_any_definition(result) then
result.w, result.h = nil
return result
end
table.insert(Spawn_candidates, result)
end
end