I new to corona sdk. My first game is in development and I found a problem with moving object. I’m trying to animate/moving the cloud from left to right constantly and it’s really choppy, not smooth.
I decided to write a simple code to test, the same problem even it’s very simple code on both simulator and device. See below (main.lua):
-- Hide the status bar. display.setStatusBar(display.HiddenStatusBar) local cloud = display.newImage( "cloud.png", 300, 100) cloud.xScale = 0.4 cloud.yScale = 0.4 local speed = 0.5 local lastTime = system.getTimer( ) local function frameUpdate( event ) local currentTime = system.getTimer( ) local elapse = currentTime - lastTime lastTime = currentTime cloud.x = cloud.x - elapse \* speed if (cloud.x \< -100) then cloud.x = display.contentWidth + cloud.width end end Runtime:addEventListener( "enterFrame", frameUpdate )
Here is the video I recorded so everyone can understand the choppy issue https://www.dropbox.com/s/x6spi7mlivvrx74/corona_test_moving.mov?dl=0. Do I make any mistake? I searched around but did not find any solution for this.
Please help and thanks in advance!