I’ve got a spawn function that randomly spawns squares that move from off-screen left to off-screen right. At a certain point, I want all the spawned squares (there are usually at least 30 on-screen at any given point) to simultaneously move downwards off-screen. However, I don’t know how to issue a command to all spawned objects.
My spawn function is very simple, and looks like this:
local function squareSpawn (event) local square = display.newRect(50, 50, 25,25) square.x = -100 square.y = math.random(0,1024) transition.to(square, {time = 1500, delay = 0, x = square.x + 968, onComplete=function() square :removeSelf() end})endtimer.performWithDelay(math.random(20,35),squareSpawn,0)[/code]When a certain conditional statement is met, I want some command like this to kick in:transition.to(all squares, {time = 1000, delay = 0, y = all squares.y + 920})[/code]I'm thinking the key might be in the method described here: http://blog.anscamobile.com/2011/09/how-to-spawn-objects-%E2%80%94-the-right-way/, but, being a beginner, I'm not sure how to apply what is being taught here to what I want to accomplish. Any help would be much appreciated.Thank you,Steven [import]uid: 79394 topic_id: 15294 reply_id: 315294[/import]
[import]uid: 71210 topic_id: 15294 reply_id: 56443[/import]