Quote: "Set your virtual resolution (SetVirtualResolution) and then create an image of the same size."
That is what I do, with a few extras.
I make the background 3x the screen width for side scrolling.
That way when it reaches the end I can reset it without the user ever realizing it, because the last third of the background is an exact copy of the first third.
The middle section is different of course, but blends seamlessly to either ends, so you essentially end up with with a scrolling background twice the screen size.
Then, I do this for clouds, mountains, and other sections as layers so I can scroll them at a different speeds.
That way the things off in the distance are moving across the screen slower than the things in the foreground.
I have a hot air balloon level that my piglet can fly infinitely in either side direction, but his height is limited to Earth's atmosphere.
(you can see the stars though)
The last time I tried to film my game play FRAPs was acting choppy, but I will try to show you what I am talking about.
Edit
Here is a low res (very low res, so keep it smaller) video of a couple of levels that I use scrolling in for Angry Piglets v2... (see attached)
The levels seem bland right now because I am still adding stuff to them, but they show you an infinite scroll using basic background images as described.
These use the method I describe above which is really easy to do by incrementing or decrementing the X position of the sprites.
Note in the balloon level that the birds flying in the same direction move slower than the ones going in the opposite direction.
The speed change is subtle, but you can notice it when I change directions as it seems more realistic for the effect.
So, in short, if input is given for the movement of the piglet, then it affects the piglets animation and the position of everything else based on their base speed (if any) plus the adjustment.
Quote: "You can do this one of 2 ways...
1. Use SetViewOffset() to scroll the world. You'll need larger-than-screen background images, or tile multiple images (better option).
2. Scroll the UV coordinates of the background image as you move. SetSpriteUVOffset()"
I have probably been doing it wrong then, because i just use a setsrpiteposition() for the background and cloud sprites just like all the other sprites.
Once it reaches the end position (either way), then it loops by resetting the position of the image, either to the first third, or third third, depending on the direction it is traveling.
if you want to do a scrolling then transition to another scrolling after awhile, then you can do the same thing by adding a non-looping 3x background in the middle...
A - B - A (looping scroll)
A - C - D (non-looping scroll for transition)
D - E - D (looping scroll)
Whereas A is the first screen background using the scroll method I am describing.
B is the middle third, leading back to A to make the first looping scroll.
We loop once the 3x background image has moved 2/3 of its total width AKA twice screen width, because the third third is then in place.
You can increment/decrement a counter for the number of scrolls if you want to allow the user to back track, and keep the transition in place.
Once you reach the end, where the second A is in place, then you switch (seamlessly) to the transition's A and scroll the transition once to D.
Once D is on place you switch again to the last background image, that has D for it's start screen, and loops back when reaching its own end.
I hope this makes sense.
That is how I do it.
Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1