Hi everyone…
Something strange in a loop
I have 10 images, 1 to 10
I would like to display the images one on top of another, like pages of a book
but I want to see No. 1 First and then 2 so 10 will be in the back.
I’m trying to learn to use for i = 1, 10, do – so I have this
for i = 10, 1 do -- Leccion No. 1 bg[i] = display.newImageRect( sceneGroup, "lessons/l" .. 11-i .. ".jpg", 600, 400 ) bg[i].x = display.contentCenterX bg[i].y = display.contentCenterY bg[i].isVisible = true end
But I see NO images at all in the App
If I do this… I CAN see the images
for i = 1, 10 do -- Leccion No. 1 bg[i] = display.newImageRect( sceneGroup, "lessons/l" .. i .. ".jpg", 600, 400 ) bg[i].x = display.contentCenterX bg[i].y = display.contentCenterY bg[i].isVisible = true end
But I see No. 10 on top
I also try this one
local number = 1 for i = 1, 10 do -- Leccion No. 1 bg[i] = display.newImageRect( sceneGroup, "lessons/l" .. number .. ".jpg", 600, 400 ) bg[i].x = display.contentCenterX bg[i].y = display.contentCenterY bg[i].isVisible = true number = number+1 end
I also SEE No. 10 on top
So how would I do it to see No. 1 on top, then No. 2, No 3 and so on…?
Thanks for all your help