Spawning boxes with a constant loop from right to left

Can someone show me an example of three different sized boxes moving from right to left coming from off the screen and leaving off the screen… Basically a constant loop where it randomly spits out different sized boxes moving across the screen at random y values…

Thanks

Jake [import]uid: 51459 topic_id: 13835 reply_id: 313835[/import]

nothing fancy, i didnt test it, so right out of the head
[lua]local rand = math.random

local function spawn_boxes()
box = display.newRect(400,rand(1,480), rand(10,50),rand(10,50) – this is your boxes spawning from outside the right side of the screen
transition.to(box, {time=1000, x=-50,y=box.y})
end

timer.performWithDelay(1000, spawn_boxes,0)[/lua]

you can then put a runtime function to destroy boxes upon leaving the screen, but its another story) good luck [import]uid: 16142 topic_id: 13835 reply_id: 50806[/import]

Awesome DARKCONSOLE!!!

Exactly what I wanted!!

THANK YOU SO MUCH :slight_smile: [import]uid: 51459 topic_id: 13835 reply_id: 50810[/import]