Jump to content
  • Advertisement
Sign in to follow this  

Parallax Positioning Problem

This topic is 2227 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all,

I have a problem that I feel is either incredibly easy to overlook or is much more complicated than I'm giving it credit for.

All I'm trying to do is align my backgrounds (which scroll in parallax both horizontally and vertically) to the foreground terrain so that you never see any gaps.

I'm setting the y position of the background segments equal to the lowest part of the terrain (because I haven't figured out the trick yet).

I build a test terrain and set the height for the segments to 0. I move the camera to 0, -240 (half the screen up) so I can see more than just terrain and voila:


As you'd expect, the first background layer with a parallax factor of 1 (none) aligns perfectly and the second bakground layer with a parallax factor of 0.5 is a quarter of the way down the screen (-240 * 0.5 = -120 relative to the camera).

Now I move the camera up to 0, -480 and get this:


Now the second layer is taking up half the screen. -480 * 0.5 = -240 relative to the camera.

So what's the trick to lining these up while accounting for the parallax scroll factor? Nothing I've tried has worked.

Thanks for your input. Edited by GroZZleR

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!