So I've been looking into making a scrollable panoramic background for a project a friend and I are doing for a potential client, I'm new to the program so my mind hasn't completely been assimilated into its structure yet.
I've implemented the touch features Abhishan detailed in his post 'Swipe based Smooth Scrolling with Inertia' and that's all swell but now I need to make the background endlessly scroll in either direction when I swipe.
Nealian's Compan360 is a good example of what I'm trying to achieve.
Any help would be much appreciated.
Develop games in your browser. Powerful, performant & highly capable.
There's 2 approaches you can try. One is to create 3 copies of your background. As you swipe you move all 3 left or right. As the first one goes off the main screen, the second slides in. And the one on the far side moves to the other side. So you are always moving the one that is off screen over to the other end to fake the panoramic look.
The other solution is there's a plugin called "sprite sheet" that allows you to animate the offset of a tiled background object.
You'd have to tweak the "sliding with inertia" code a bit and point it at offsetting the offset.x value instead of the positional value, but it should work. It will give you an endless panorama bg.