Any 1 can help me solve problem with scrolling, a black space showing up time by time on left side. watch a video.
looks like you’re moving textures and swapping their positions?
Use more textures. Depending on the width of the texture, you need at least 3.
Alternately, just use a single texture and do this:
-- == -- parallaxBack -- == display.setDefault( "textureWrapX", "repeat" ) local parallaxBack = display.newRect( display.contentWidth, display.contentHeight) parallaxBack.x = display.contentCenterX parallaxBack.y = display.contentCenterY parallaxBack.fill = { type="image", filename="back.jpg" } -- display.setDefault( "textureWrapX", "clampToEdge" ) -- local lastT = system.getTimer() function parallaxBack.enterFrame( self ) local curT = system.getTimer() local dt = curT - lastT lastT = curT local dx = dt \* 0.00005 local fillX = self.fill.x fillX = fillX + dx if( fillX \< -1 ) then fillX = fillX + 2 end self.fill.x = fillX end; listen("enterFrame", parallaxBack )
Yeah, the reason as to why this is happening is due to you using too few images or moving them from left to right too soon. You are seeing that black area because apparently you run out of images to show on the left as they are (probably) all stacked to the right of the screen.
looks like you’re moving textures and swapping their positions?
Use more textures. Depending on the width of the texture, you need at least 3.
Alternately, just use a single texture and do this:
-- == -- parallaxBack -- == display.setDefault( "textureWrapX", "repeat" ) local parallaxBack = display.newRect( display.contentWidth, display.contentHeight) parallaxBack.x = display.contentCenterX parallaxBack.y = display.contentCenterY parallaxBack.fill = { type="image", filename="back.jpg" } -- display.setDefault( "textureWrapX", "clampToEdge" ) -- local lastT = system.getTimer() function parallaxBack.enterFrame( self ) local curT = system.getTimer() local dt = curT - lastT lastT = curT local dx = dt \* 0.00005 local fillX = self.fill.x fillX = fillX + dx if( fillX \< -1 ) then fillX = fillX + 2 end self.fill.x = fillX end; listen("enterFrame", parallaxBack )
Yeah, the reason as to why this is happening is due to you using too few images or moving them from left to right too soon. You are seeing that black area because apparently you run out of images to show on the left as they are (probably) all stacked to the right of the screen.