Spawning items with initial velocity

Hi

I’m currently trying to create a piece of code that will apply velocity to a set of particles one after another from a point (small time steps so as to make it look like a constant stream of particles) and then apply a force to these particles at a later point so their path changes. Does anyone have any ideas on how to do this?

Right now I can make it spawn in all of the particles but all at the same time (instead of one after another) and then the initial velocity and applied force only interact with one of the particles.

Thanks

You could try a timer loop:

--Call loop of 100 particles timer.performWithDelay( 25, function() --Create particle local particle = display.newRect(100,100,5,5) particle:setFillColor( 1,0,0 ) --Move it transition.to(particle, { x = math.random(150,250), y = math.random(150,250), onComplete = function(particle) --Remove It particle:removeSelf() particle = nil end }) end, 100)

You could try a timer loop:

--Call loop of 100 particles timer.performWithDelay( 25, function() --Create particle local particle = display.newRect(100,100,5,5) particle:setFillColor( 1,0,0 ) --Move it transition.to(particle, { x = math.random(150,250), y = math.random(150,250), onComplete = function(particle) --Remove It particle:removeSelf() particle = nil end }) end, 100)