Background animation problem

Hi!
I have problem with animation of background. What happens on right side screen?
This video present the problem : http://youtu.be/DJNNk4YClzU
Source responsible for this

local tlo = display.newImage("tlo.png")  
local tlo2 = display.newImage("tlo.png")  
tlo.x = 0  
tlo2.x = 959  
local function przesuwaj(event)  
tlo.x = tlo.x - 15  
 tlo2.x = tlo2.x - 15  
 if (tlo.x + tlo.contentWidth) \< 0 then  
 tlo.x = tlo.x + 959  
 end  
--tlo2.contentWidth  
 if (tlo2.x + tlo2.contentWidth) \< 960 then  
 tlo2.x = tlo2.x + 959  
 end  
end  

image resolution is W 959 H 320

Please Help and Thanks for answers [import]uid: 117910 topic_id: 20473 reply_id: 320473[/import]

Take a look at the code in CoronaSDK > SampleCode > Sprites > JungleScene.

That is very close to what you are doing with a slightly different method of handling the situation; I think it will help you.

Peach :slight_smile: [import]uid: 52491 topic_id: 20473 reply_id: 80306[/import]

[code]local tlo = display.newImage(“tlo.png”)
local tlo2 = display.newImage(“tlo.png”)
tlo:setReferencePoint( display.CenterLeftReferencePoint )
tlo2:setReferencePoint( display.CenterLeftReferencePoint )
local function przesuwaj(event)
local tDelta = event.time - tPrevious
tPrevious = event.time

local xOffset = ( 0.2 * tDelta )

tlo.x = tlo.x - xOffset
tlo2.x = tlo2.x - xOffset
if (tlo.x + tlo.contentWidth) < 0 then
tlo:translate( 959 * 2, 0)
end
if (tlo2.x + tlo2.contentWidth) < 0 then
tlo2:translate( 959 * 2, 0)
end
end[/code]
Now the problem occurs on the left side of the screen [import]uid: 117910 topic_id: 20473 reply_id: 80323[/import]

Try this, plug and play;

[lua]local tlo = display.newRect( 0, 0, 959, 320 )
local tlo2 = display.newRect( 959, 0, 959, 320 )
tlo2:setFillColor(100,100,100)
tlo:setReferencePoint( display.CenterLeftReferencePoint )
tlo2:setReferencePoint( display.CenterLeftReferencePoint )

local tPrevious = system.getTimer()
local function move(event)
local tDelta = event.time - tPrevious
tPrevious = event.time

local xOffset = ( 0.2 * tDelta )

tlo.x = tlo.x - xOffset
tlo2.x = tlo2.x - xOffset
if (tlo.x + tlo.contentWidth) < 0 then
tlo:translate( 959 * 2, 0)
end
if (tlo2.x + tlo2.contentWidth) < 0 then
tlo2:translate( 959 * 2, 0)
end
end
Runtime:addEventListener( “enterFrame”, move )[/lua]

Peach [import]uid: 52491 topic_id: 20473 reply_id: 80328[/import]

The same. I think it might be something wrong with the status bar

display.setStatusBar(display.HiddenStatusBar)

it’s ok? [import]uid: 117910 topic_id: 20473 reply_id: 80332[/import]

Uh no, that should be fine.

What device are you simulating? The code above working fine when I tried it simulating an iPhone - so let me know.

Peach [import]uid: 52491 topic_id: 20473 reply_id: 80537[/import]

How i can change device? I use default simulator. [import]uid: 117910 topic_id: 20473 reply_id: 80576[/import]

When you choose to open a project there is a drop down box choosing which device you simulate :slight_smile: [import]uid: 52491 topic_id: 20473 reply_id: 80583[/import]

Even in free version? Thanks for your patience :slight_smile: [import]uid: 117910 topic_id: 20473 reply_id: 80591[/import]

That’s fine.

Yes, even in the free version there are multiple skins available. Are you using 703 or 704? 704 has two skins that were missing in 703.

Peach :slight_smile: [import]uid: 52491 topic_id: 20473 reply_id: 80770[/import]

It’s work on iPhone :slight_smile:
Thanks for help and your time [import]uid: 117910 topic_id: 20473 reply_id: 81035[/import]

Excellent!

Peach :slight_smile: [import]uid: 52491 topic_id: 20473 reply_id: 81070[/import]