Hello,
I have 2 different computers that I program Corona apps with.
I have a moving background in an app that I’ve been working on.
To accomplish this I used a timer on an infinite loop. Here is the code:
CODE
local back1 = display.newImage( “tetris_background.png” )
local back2 = display.newImage( “tetris_background.png” )
local backScale = display.contentWidth/back1.width
back1:scale( backScale, backScale )
back1.x, back1.y = display.contentCenterX, display.contentCenterY
back1:setFillColor( .5, .5, .75, .8)
back2:scale( backScale, backScale )
back2.x, back2.y = display.contentCenterX, display.contentCenterY - (back2.height*backScale)
back2:setFillColor( .5, .5, .75, .8)
print(back1.y)
local function backReset()
print(back1.y)
back1.y = display.contentCenterY
back2.y = display.contentCenterY - back2.height*backScale
print(back1.y)
end
local function backMove (event)
transition.to( back1, {time = 10000, y = display.contentCenterY + (back1.height*backScale)} )
transition.to( back2, {time = 10000, y = display.contentCenterY} )
timer.performWithDelay( 10000, backReset )
end
backMove()
timer.performWithDelay( 10000, backMove, 0 )
For 1 of the computers the background scrolls infinitely like it is intended to do.
The second computer however runs the scroll only once (from the time that backMove() is first called)
I assumed that the timer loop was not running so I added the print statements.
However when run on the second computer the correct y values are printed out - meaning that the images are moving.
It is just that the simulator does not show the graphics transitioning down on the second computer.
When compiled from the first computer and put onto my android device, the animation works.
When compiled from the second computer and put onto my phone, the animation runs once and stops just like on the simulator on the second computer.
Is there any explanation for why this happens / previous record of this happening (and maybe a solution)?
I need both computers because one is a home and one is a school computer
Computer 1 is running windows 8.1 with integrated graphics on a 4th gen i5 cpu
Computer 2 is running windows 7 radeon 6700 graphics and an amd fx-6300