How I can make an image fall down randomly as if meteors or something?

I dont know how to do that an image go from top to bottom like meteors and appear all over the screen, one after the other

This isn’t a simple question because we need to know more about what you want.  Are you wanting them to accelerate with gravity?  Should the come in at angles are fall straight down?

It changes how you should do them.

What i want is that the images fall from the top side of the screen and start falling down accelerating, they would only be falling straight down, alternating positions, meaning one on the right, then another one in the middle, and then another one on the left side and so on in the different positions, until they disappear at the bottom of the screen

I would think using physics for this might be the best route.  Start here:

http://coronalabs.com/resources/tutorials/physics-box2d/

to learn about using physics.  Here is a tutorial on spawning objects:
 

http://coronalabs.com/blog/2011/09/14/how-to-spawn-objects-the-right-way/

You would want to spawn your objects off screen, give them a physics body, perhaps some initial velocity and then let physics take over moving them.  You would have a “floor” body (perhaps just an invisible rectangle off the bottom of the screen) and detect when the object collides with it as a trigger to remove it.

Rob

I tried this 

function moveMeteors( ) for i = 1, math.random(1, 2) do meteors = display.newImage("meteor.png") screenGroup:insert(meteors) meteors.x = (math.random(display.contentWidth)) meteors.y = centerY - 340 transition.to( meteors, {time = math.random(3500 - speedMeteor, 4500 - speedMeteor), y = 1000 + speedMeteor, onComplete = clear }) speedMeteor = speedMeteor + 10 end end

But, sometimes the images appear one over the other and I do not want that, I mean, each image appear and go from the top to the bottom of the screen in his own line. I hope that I’ve explained this well. :slight_smile:

This isn’t a simple question because we need to know more about what you want.  Are you wanting them to accelerate with gravity?  Should the come in at angles are fall straight down?

It changes how you should do them.

What i want is that the images fall from the top side of the screen and start falling down accelerating, they would only be falling straight down, alternating positions, meaning one on the right, then another one in the middle, and then another one on the left side and so on in the different positions, until they disappear at the bottom of the screen

I would think using physics for this might be the best route.  Start here:

http://coronalabs.com/resources/tutorials/physics-box2d/

to learn about using physics.  Here is a tutorial on spawning objects:
 

http://coronalabs.com/blog/2011/09/14/how-to-spawn-objects-the-right-way/

You would want to spawn your objects off screen, give them a physics body, perhaps some initial velocity and then let physics take over moving them.  You would have a “floor” body (perhaps just an invisible rectangle off the bottom of the screen) and detect when the object collides with it as a trigger to remove it.

Rob

I tried this 

function moveMeteors( ) for i = 1, math.random(1, 2) do meteors = display.newImage("meteor.png") screenGroup:insert(meteors) meteors.x = (math.random(display.contentWidth)) meteors.y = centerY - 340 transition.to( meteors, {time = math.random(3500 - speedMeteor, 4500 - speedMeteor), y = 1000 + speedMeteor, onComplete = clear }) speedMeteor = speedMeteor + 10 end end

But, sometimes the images appear one over the other and I do not want that, I mean, each image appear and go from the top to the bottom of the screen in his own line. I hope that I’ve explained this well. :slight_smile: