Hello, I am a newbie. I have 6 images that scroll vertically. I would like to make
these images come up randomly. There are distinguished by color so red image, yellow image
Etc. Can someone please help? [import]uid: 133869 topic_id: 25900 reply_id: 325900[/import]
Would really have to see some code to advise, though there are a few threads on similar topics that may be useful already scattered around the forum
[import]uid: 52491 topic_id: 25900 reply_id: 104838[/import]
Hi Peach Pelle,
this is my first game, im sure theres a better way. I would like to have the balls change order.
background = display.newImage( “nightstars.png” )
pinkball = display.newImage( “pink.png” )
pinkball.x = display.stageWidth/ 2
pinkball.y = display.stageHeight/ 1
pinkball.xScale = .5
pinkball.yScale = .5
local function scroll()
pinkball.y = pinkball.y -5;
if(pinkball.y <= -1100) then
pinkball.y = 1100;
end
pinkball.y = pinkball.y -1;
if(pinkball.y <= -1100) then
pinkball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll);
yellowball = display.newImage( “yellow.png” )
yellowball.x = display.stageWidth/ 2
yellowball.y = display.stageHeight/ 1.4
yellowball.xScale = .5
yellowball.yScale = .5
local function scroll()
yellowball.y = yellowball.y -5;
if(yellowball.y <= -1100) then
yellowball.y = 1100;
end
yellowball.y = yellowball.y -1;
if(yellowball.y <= -1100) then
yellowball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll);
greenball = display.newImage( “green.png” )
greenball.x = display.stageWidth/ 2
greenball.y = display.stageHeight/ 2.3
greenball.xScale = .5
greenball.yScale = .5
local function scroll()
greenball.y = greenball.y -5;
if(greenball.y <= -1100) then
greenball.y = 1100;
end
greenball.y = greenball.y -1;
if(greenball.y <= -1100) then
greenball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll);
blueball = display.newImage( “blue.png” )
blueball.x = display.stageWidth/ 2
blueball.y = display.stageHeight/ 6.1
blueball.xScale = .5
blueball.yScale = .5
local function scroll()
blueball.y = blueball.y -5;
if(blueball.y <= -1100) then
blueball.y = 1100;
end
blueball.y = blueball.y -1;
if(blueball.y <= -1100) then
blueball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll);
redball = display.newImage( “red.png” )
redball.x = display.stageWidth/ 2
redball.y = display.stageHeight/ -1
redball.xScale = .5
redball.yScale = .5
local function scroll()
redball.y = redball.y -5;
if(redball.y <= -1100) then
redball.y = 1100;
end
redball.y = redball.y -1;
if(redball.y <= -1100) then
redball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll);
orangeball = display.newImage( “orange.png” )
orangeball.x = display.stageWidth/ 2
orangeball.y = display.stageHeight/ -1.5
orangeball.xScale = .5
orangeball.yScale = .5
local function scroll()
orangeball.y = orangeball.y -5;
if(orangeball.y <= -1100) then
orangeball.y = 1100;
end
orangeball.y = orangeball.y -1;
if(orangeball.y <= -1100) then
orangeball.y = 1100;
end
end
Runtime:addEventListener(“enterFrame”, scroll); [import]uid: 133869 topic_id: 25900 reply_id: 104892[/import]
Just a tip for future reference, please post your code inside < lua > and < /lua > tags - makes it easier to read 
For this, there are a few ways you might do it but I would think the easiest way would be to put the images in a table and then shuffle it so they are in a random order. Check this out; http://developer.anscamobile.com/code/shufflerandomize-tables
Then from there you could add them in the order they are in the table.
I would also point out that your Runtime listeners, you don’t need so many and you shouldn’t reuse function names like that. You could put all the ball movement stuff within one function 
I am going to be traveling this weekend but please let me know how you go - will check this thread on Monday to see have you have got on.
Peach
[import]uid: 52491 topic_id: 25900 reply_id: 105017[/import]
Thanks Peach! I literally just started with Corona and am excited about learning the language, its so foreign to me 
I think I am going to take advantage of the one on one training. [import]uid: 133869 topic_id: 25900 reply_id: 105238[/import]
How did you get on with your image randomization stuff? Did the thread help?
[import]uid: 52491 topic_id: 25900 reply_id: 105329[/import]
Hi Peach!
No im lost : )…
I am going to sign up for one on one. Do you provide tutoring? [import]uid: 133869 topic_id: 25900 reply_id: 105338[/import]
Hi Peach!
No im lost : )…
I am going to sign up for one on one. Do you provide tutoring?
[import]uid: 133869 topic_id: 25900 reply_id: 105340[/import]
Hey again - if you are wondering why you “double posted”, double clicking the button does it. (We need new forum software… I know.)
RE tutoring, we do an intro course and yes, I am often the one to do that. It goes over some of the very basics and helps you get to grips with Corona.
If you want more details on that you can contact us using one of our support forms or you can email me at peach[at]anscamobile.com and I can answer any questions you have.
Peach
[import]uid: 52491 topic_id: 25900 reply_id: 105358[/import]