Hello! I’m sorry for my bad english, but I do not know where I still have to ask for help.
I’m newbee in Corona SDK and Lua. I created the first mobile game for android and posted it on Google Play Market (alpha testing now).
The idea is simple: move the car left and right to dodge obstacles (walls and bombs). The problem is that when there is a movement, there are lags, because of which it is impossible to play.
When testing the game on the simulator Corona no such problems, everything works well.
The problem is there on android.
Can anyone encountered this problem? What to do in such cases? Maybe I misunderstood the logic of the movement?
Below is a snippet of code that describes the logic of the movement of the background:
\_W = display.contentWidth \_H = display.contentHeight ... function scene: createScene(event) local screenGroup = self.view bg = display.newImageRect("img/bg.png",\_W,\_H\*2) --first background bg.anchorX = 0 bg.anchorY = 1 bg.x = 0 bg.y = \_H bg.speed = 4 screenGroup: insert(bg) bg2 = display.newImageRect("img/bg.png",\_W,\_H\*2) -- second backgroung bg2.anchorX = 0 bg2.anchorY = 1 bg2.x = 0 bg2.y = - bg.contentHeight/2 bg2.speed = 4 screenGroup: insert(bg2) ... end function bgScroller(event) bg:translate( 0, \_H/50 ) bg2:translate( 0, \_H/50 ) if bg.y \> \_H\*3 then bg.y = bg2.y - bg.contentHeight end if bg2.y \> \_H\*3 then bg2.y = bg.y - bg2.contentHeight end end ... function scene:enterScene(event) ... moveTimerBg = timer.performWithDelay(2, bgScroller, -1) end
The idea is that when going below the first screen pattern, it is returned to top of the screen and moves on the screen of the second pattern.
Thanks.