Sorry for such a noob question, but I am trying to increment a variable from 1 to 8 in a set amount of time, but I cant seem to get it to work correctly. Here is my code as of right now:
local gameLoop = function ( event )
if gameIsActive then
scrollSpeed = 1
local moveBuildings = function()
leftBuilding1.y = leftBuilding1.y + scrollSpeed
if leftBuilding1.y \>= 720 then
leftBuilding1.y = -240
end
leftBuilding2.y = leftBuilding2.y + scrollSpeed
if leftBuilding2.y \>= 720 then
leftBuilding2.y = -240
end
rightBuilding1.y = rightBuilding1.y + scrollSpeed
if rightBuilding1.y \>= 720 then
rightBuilding1.y = -240
end
rightBuilding2.y = rightBuilding2.y + scrollSpeed
if rightBuilding2.y \>= 720 then
rightBuilding2.y = -240
end
end
timer.performWithDelay(2000, moveBuildings)
--transition.to(scrollSpeed, {delay=2000, time=2000, scrollSpeed=8})
end
end
Basically I want the buildings to start off slowly scrolling (scrollSpeed = 1) and then increase in speed over a 2 second time frame to a higher value (scrollSpeed = 8).
Im sure it is easy im just having some issues. Does anyone have any idea’s on how to make this work properly? Thanks a lot in advance!
-Kyle [import]uid: 9968 topic_id: 4520 reply_id: 304520[/import]