Sign in to follow this  

Parallax Positioning Problem

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this