Hey guys,
I was wandering about referencing the system.time() to move an object as it runs the function (enterframe). What I mean is to make something move the same speed no matter the speed the program is running at and how many times it is calling enterframe.
At the moment my game makes platforms move up the screen by like; every frame a function is called to take 2 off y position. But I think if the ram is low and runs the game slower than my computer, the platforms will not keep up with time… If that makes sense…?
They also have to eventually be recycled to the top…
So basicly I need to know ‘How long was it since this function was ran’.
Code atm…
[lua]
local resetPlatforms = function()
if platform.y <= 0 then
platform.y = display.contentHight() + 50
end
end
local movePlatforms = function()
platform.y = platform.y - 2
end
local enterFrame = function()
movePlatforms()
resetPatforms()
end
Runtime:addEventListener(“enterframe”, enterFrame)
[/lua]
