Hey Community,
I have a problem that took me several hours without any solution.
Actually I am building a endless runner app with moving background (parallax effect) and moving platforms the player can jump to.
I update the background as well as the platforms on every frame. I started moving the objects with a constant “speed”-value. The result was a jerky image movement.
You can see this behaviour here:
https://www.dropbox.com/s/bn17r80047mh2sv/corona_scroll_test.mp4
After a bit testing I figured out, that the frame rate is not constant (something between 20 - 66 FPS), so
I improved the movement by moving the objects frame-independent, as you can see in the code below.
Sadly this did not fix the problem.
Funnily enough, it is also jerky when moving the objects very slowly…
After a long research I found a couple of people having the same issue, but it seems, that no one has a solution.
Thanks in advance to everyone replying to get a step closer to a solution.
Best regards
Chris
local runtime = 0 local function onEveryFrame( event ) local temp = system.getTimer() dt = (temp - runtime) / (1000 / display.fps) runtime = temp ... for i = self.myobjects.numChildren, 1, -1 do child = self.[myobjects] -- Move object child.x = child.x -(speed\*dt) ...