Hi all.
I’ve been trying to create a seamless scrolling background that is 3 screens wide (IT is a seamless BG) and for the life of me a cannot get my ordering worked out… My mind is blank.
Can you help?
this is my code for it
local smoke1 = display.newImage("smoke\_1.png", -960, 265)
local smoke2 = display.newImage("smoke\_2.png", -480, 265)
local smoke3 = display.newImage("smoke\_3.png", 0, 265)
-- Animate Smoke Start
local tPrevious = system.getTimer()
local function moveSmoke(event)
local tDelta = event.time - tPrevious
tPrevious = event.time
local xOffset = ( 0.1 \* tDelta )
smoke1.x = smoke1.x + xOffset
smoke1.y = display.contentHeight / 2
smoke2.x = smoke2.x + xOffset
smoke2.y = display.contentHeight / 2
smoke3.x = smoke3.x + xOffset
smoke3.y = display.contentHeight / 2
if smoke1.x \> display.contentWidth + smoke1.width then
smoke1:translate( -480 \* 4, 0)
end
if smoke2.x \> display.contentWidth + smoke2.width then
smoke2:translate( -480 \* 4, 0)
end
if smoke3.x \> display.contentWidth + smoke3.width then
smoke3:translate( -480 \* 4, 0)
end
end
Runtime:addEventListener("enterFrame",moveSmoke)
Any help would be appreciated.
Cheers
Alcamie [import]uid: 9457 topic_id: 2971 reply_id: 302971[/import]
[import]uid: 9457 topic_id: 2971 reply_id: 8917[/import]