side scroller memory management

These are the resolutions I’m using with the ultimate config.lua (Please let me know if I’m wrong)

360 * 570

1140 * 720

2280 * 1440

   Hello guys … I’m creating a side scroller background. This is what my code looks like

 bg1 = display.newImageRect("assets/images/bg1.png",\_W,\_H) bg1.x=0 bg2 = display.newImageRect("assets/images/bg2.png",\_W,\_H) bg2.x=\_W bg3 = display.newImageRect("assets/images/bg3.png",\_W,\_H) bg3.x=\_W\*2 bg4 = display.newImageRect("assets/images/bg4.png",\_W,\_H) bg4.x=\_W\*3 local function scrollWorld(self,event) if self.x \< -\_W then self.x = \_W\*3 else self.x = self.x - sceneSpeed - 10 end end bg1.enterFrame = scrollWorld; bg2.enterFrame = scrollWorld; bg3.enterFrame = scrollWorld; bg4.enterFrame = scrollWorld; Runtime:addEventListener("enterFrame", bg1) Runtime:addEventListener("enterFrame", bg2) Runtime:addEventListener("enterFrame", bg3) Runtime:addEventListener("enterFrame", bg4)

The code runs just fine but there’s a thin line (gap) appears between images. please help me remove those lines i.e. the images should appear seamless??

And I have one more doubt … is there a better way to do this because loading so many images (actually there are 15-18 backgroung images … yeah bg15 …) might cause difficulties for the actual devices to handle the texture memory … so any help regarding just loading the currently needed background images and scrolling them smoothly and seamlessly would be appreciated alot …Thanx :slight_smile:

You should use the Dusk Engine. Check it out here:

https://github.com/GymbylCoding/Dusk-Engine

The Dusk Engine is a tile based engine. You use the map editor Tiled to put together your levels. Then use dusk to load the map up. The engine culls tiles, calling them just before they come on the screen and removing them as they move off the screen. There is a learning curve, still not much in the way of documentation or tutorials, but it’s the go to approach to creating a platformer or constant runner style game.

that does not solve my problem … but thnx 4 d reply … it’s good to learn new things :slight_smile:

You should use the Dusk Engine. Check it out here:

https://github.com/GymbylCoding/Dusk-Engine

The Dusk Engine is a tile based engine. You use the map editor Tiled to put together your levels. Then use dusk to load the map up. The engine culls tiles, calling them just before they come on the screen and removing them as they move off the screen. There is a learning curve, still not much in the way of documentation or tutorials, but it’s the go to approach to creating a platformer or constant runner style game.

that does not solve my problem … but thnx 4 d reply … it’s good to learn new things :slight_smile: