Hi guys,
I followed multiple tutorials on parallax background for 2D and I am facing a strange problem. When I use parallax background, the position of my player’s sprite is somehow affected ( see screenshot below ).
I created a simple scene with parallax background and another subscene containing a CharacterBody2D with a Sprite2D and Camera. If I add a collisionBody, you can see that the collision body is always at the center of the screen (correct) but the sprite is rendered outside of the player position (incorrect)
I made several test project but it always ends like this Can you give a hint what am I doing wrong?
Thanks
If I move my player from left to right, the player’s sprite moves from left side of the screen to right side. The collisionShape renders where It should, the center of the screen
That’s weird. I can’t find any problems in your scene tree. Some options you can explore:
try making the characterbody (player) the child of the Node2d instead of the parallax background. I highly doubt this is causing it but it’s worth a try.
Make sure the players sprite2d is not set as top level. When a node is set as top level, it doesn’t take the position of it’s parent.
Same problem here, The problem happens exactly when I change the “mirroring” function of the parallaxlayer, the distance at which the player’s sprite moves away from the starting point seems to have the same value added to “mirroring” regardless of whether it is done by the code or by the interface