Horizontal/Vertical scroller *SOLVED*

Could anyone help me in figuring out how to repeat a background image to repeat like in some vertical/horizontal endless scroller games where the background keeps moving down or left like it’s an endless picture but it’s actually just one picture that repeats? Any help would be appreciated :slight_smile:

I know two or three ways to achieve it.
Here is a nice way :wink:
InfiniteBackground.rar (24.7 KB)
It uses a tile background, and move the texture offset.

Another way could be with two/three backgrounds, and move them automatically to fill the sides, as here :slight_smile:

Thanks for this Lizard! Could you explain it more though? I don’t get what’s happening. I think you just MOVING the background to the next screen via the offset but why does it duplicate instead of moving?

Really curious as to how this works also since you’re not creating another background object to display to the next screen so I’m guessing this is really efficient.

You can see what is happening if you add the event:

At the beginning of the scene      |      Change camera zoom to 0.5

You’ll see it:
The Background is following the Player all the time, the illusion of movement is given by the texture offset (i.e. from where the texture is repeated), modify the texture offset in function of the Player’s position make the trick :wink:

I think playing with the texture offset finally made me get how it works. Thank you so much! :slight_smile: