hi
i want move background image infinite time depends on “accelerometer”…please help me
right now, background image moveing infinite time on “Runtime”
code here…
[lua]local bg1 = display.newImage(“background02.jpg”)
bg1:setReferencePoint(display.CenterLeftReferencePoint)
bg1.x = 0
bg1.y = 400
localGroup:insert(bg1)
local bg2 = display.newImage(“background02.jpg”)
bg2:setReferencePoint(display.CenterLeftReferencePoint)
bg2.x = 1020
bg2.y = 400
localGroup:insert(bg2)
local tPrevious = system.getTimer()
local function move(event)
local tDelta = event.time - tPrevious
tPrevious = event.time
local yOffset = ( 0.15 * tDelta )
bg1.x = bg1.x + yOffset
bg2.x = bg2.x + yOffset
if bg1.x > 1020 then
bg1:translate( bg1.x, 0)
end
if bg2.x > 1020 then
bg2:translate( bg1.x, 0)
end
end
Runtime:addEventListener( “enterFrame”, move )[/lua] [import]uid: 87661 topic_id: 25869 reply_id: 325869[/import]
[import]uid: 52491 topic_id: 25869 reply_id: 104621[/import]