2
\$\begingroup\$

I'am starting to develop a 2D game with motorbikes.

My Question now is: When my bike reaches the right edge the world should move. (Like in that game: Game example) My first thought was to implement a camera and to create a huge image for the world. (e.g 4096 x 512). So I only have to move the camera to solve the problem.

Is that a good solution?!

Thank your.

Regards, Matthias

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

What you can do (And what i think many others do) is to split that 4096 into X number of widths (Lets say thats 8 segments of 512.) Then when one of your current background is almost at the end, you can get the next segment ready and position it right next to the previous one.

To add a little more to that, you can also prepare more than just the next segment. So for example, you can keep 3 loaded at one time to keep any edges from showing. So you would have the previous segment, the current one and the next segment loaded.

This is a fairly good way to help reduce the large size of that background. Hope this isn't too confusing. I can whip up some images or code snippets to help if you need.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .