How do I emulate parallax scrolling as seen in 2D Physics Platformer Demo? [SOLVED]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By soundchaser.jon

So to specify, I am making a 2D platformer with some art assets from OGA. I have a parallax background that scrolls properly when I move from left to right, but when I drop down roughly 128 pixels the background does not move with the character.

I want to try and get the background to behave the way it does in the 2D Physics Platformer Demo

In this demo the background is fairly small compared to the rest of the level, but there is never a point in time where it moves out of the viewport. Can anyone point me in the right direction?

Below is a picture of what I am referring to:

And yes, I did make a post asking a similar question on the developer’s forum a few days ago. Any help would be appreciated. Thank you in advance!

:bust_in_silhouette: Reply From: shmellyorc

you need:

in this order:

ParallaxBackground Node

ParallaxLayer Node

that does not work for me

code | 2018-07-24 11:37

That’s how I have it arranged. It is set up in a separate scene actually. Then that scene is instanced into the main level node. Is the instancing bit where the error is occuring?

soundchaser.jon | 2018-07-25 20:23

:bust_in_silhouette: Reply From: code

u have to flow this order parallax background,parallax layer, sprite for background set the
motion scale to zero set mirroring to screen width but this is not completely perfect becus ur background might break

I had noticed while I was trying to adjust the settings that my background will now load in an odd manner if my character moves left or right through the level. By odd, I mean that it does mirror, but there will be blank space until a certain distance is traveled and then it will suddenly appear onscreen.

soundchaser.jon | 2018-07-25 20:25

i dont know the solution to that
the only thing i did was to create the parallax background and add a sprite with the background texture to the player

code | 2018-08-01 16:28

:bust_in_silhouette: Reply From: soundchaser.jon

I figured it out! I studied the Demo super hard and the answer was painfully obvious. On the ParallaxBackground node, in the inspector under “Scroll”, there is a setting called “Base Scale”. So to achieve what I was looking to do, I just needed to change the Y vector to 0. Now it looks exactly the way I want it! Thank you everyone for all of your input :slight_smile: