Hi, I used this code to create a scrolling background with 7 images, the problem is that it display just 2 images instead of 7, how can I fix it? thanks
[code]
local bg1 = display.newImage(“backGround01.png”, 0, 0); – place bg1 at the origin
local bg2 = display.newImage(“backGround02.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
local bg3 = display.newImage(“backGround03.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
local bg4 = display.newImage(“backGround04.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
local bg5 = display.newImage(“backGround05.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
local bg6 = display.newImage(“backGround06.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
local bg7 = display.newImage(“backGround07.png”, 0, bg1.y + (bg1.height * 1.5)); – place bg2 right after bg1
–local bg8 = display.newImage(“backGround08.png”, 0, bg2.y + (bg2.height * 1.5));
–bg1.x,bg2.x = 160,160
local moveBG = function(e)
bg1:translate(0, bgSpeed); – move bg1 bgSpeed on the y plane
bg2:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
bg3:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
bg4:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
bg5:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
bg6:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
bg7:translate(0, bgSpeed); – move bg2 bgSpeed on the y plane
if ((bg1.y - bg1.height / 2) > display.contentHeight) then
bg1.y = bg2.y - bg2.height;
elseif((bg2.y - bg2.height / 2) > display.contentHeight) then
bg2.y = bg1.y - bg1.height;
elseif((bg3.y - bg3.height / 2) > display.contentHeight) then
bg3.y = bg1.y - bg1.height;
elseif((bg4.y - bg4.height / 2) > display.contentHeight) then
bg4.y = bg1.y - bg1.height;
elseif((bg5.y - bg5.height / 2) > display.contentHeight) then
bg5.y = bg1.y - bg1.height;
elseif((bg6.y - bg6.height / 2) > display.contentHeight) then
bg6.y = bg1.y - bg1.height;
elseif((bg7.y - bg7.height / 2) > display.contentHeight) then
bg7.y = bg1.y - bg1.height;
end
end
[/code] [import]uid: 76800 topic_id: 24796 reply_id: 324796[/import]