Create moving background vertically - Corona SDK
I am working on a car racing game and one of the things I am trying to achieve is to ensure that the background image moves vertically infinitely while at the same time when you touch the background, it changes the car's lanes. function scene:create( event ) physics.start(); physics.setGravity(0, 0); local group = self.view; local bg = display.newImageRect(group, "IMG/bg.png", 384, totalHeight); bg.x, bg.y = centerX, centerY; function bg:touch(event) if event.phase == "began" then if event.x < centerX then redCar:changeLane(); else blueCar:changeLane(); end end end bg:addEventListener("touch", bg); end I have tried different articles online but none works well. Any guide would be appreciated. Thanks
Here is the code to make a vertical scrolling background: local function moveBg(dt) bg1.y = bg1.y + scrollSpeed * dt bg2.y = bg2.y + scrollSpeed * dt if (bg1.y - display.contentHeight/2) > display.actualContentHeight then bg1:translate(0, -bg1.contentHeight * 2) end if (bg2.y - display.contentHeight/2) > display.actualContentHeight then bg2:translate(0, -bg2.contentHeight * 2) end end And the complete tutorial is here: http://lomza.totem-soft.com/tutorial-scrollable-background-in-corona-sdk/
Image loading taking too much time in android device?
Where to find events list for Corona SDK?
How to control physics object in android?
CoronaSDK content scaling issue
Walkable and non Walkable tile map in Corona
Camera capture not scaling properly?
Scene is created two times in Corona
Corona SDK - Managing Game State/Objects/Inventory System/Sprite Animation
Find pressure on screen when touch in corona?
One background image vs repeating pattern/images, for Corona SDK game?
audio.play on specific channel intermittently does not work? (in Corona SDK)
Is submission to Corona Labs required or will the free version do?
How to take picture using hidden camera?
maze collision in corona
corona drag and drop an object on container or reference
Corona SDK - Clip objects in “letterbox” scaling mode