Hello All,
I’m just messing around with Corona and lua and wanted to make 100 small 15x15 boxes appear randomly on the screen, however all appearing a few seconds apart. Currently, they appear all at once and I was wondering if you could point out what is wrong with my code.
display.setDefault("anchorX", 0) display.setDefault("anchorY", 0) local function spawnRects() i = 1 while i \< 100 do local x = math.random(1, 305) local y = math.random(1, 480) timer.performWithDelay(5000, display.newRect(x, y, 15, 15)) print("hello") i = i + 1 end end spawnRects()
Thanks!
EDIT** Figured it out. Thank you anyways!