TileMap sprites breaking after adding a ParallaxBackground

Godot Version

4.2.2

Question

Early days learning Godot and hit a weirdness when trying to use Parallax backgrounds. Searched around on the net, forums etc but couldn’t find anything similar.

When I add a ParallaxBackground > ParallaxLayer > Sprite2D it makes some of my tiles in my tile map layer “jump around”. The hitboxes are still there and working but the sprits themselves either disapear or move and scale on the screen somewhere. Moving the player character (which has an attached camera) seems to make the tile map sprites “jump in and out”.

I’ve left pretty much all the properties of the parallax layers as default (position etc.) but nothing seem to fix the problem. It’s a pretty basic scene so I’m guessing I’m doing something very wrong.

If it’s any help, this is me trying my best to follow chapter 4 of Chris Bradfields book: Godot 4 - Game Development Projects.

Cheers!

p.s. I made a video of the bug but as I’m a new user I can’t upload video attachments! So two slightly dodgy screengrabs instead

try putting the parallax on a different z

Screenshot 2024-06-05 114659

Tried both -1 and +1 Z Index for both the ParallaxLayer and Spire2D, and none of those changes fixed the issue. Also tried unchecking ‘Z as Relative’ but didn’t fixed the problem either.

Can you show us the node hierarchy of the scene? Did you put the tilemap as child of parallax?

If I delete the Camera2D node from the Player scene then the problem goes away. I added the Camera2D node back in without changing any properties and removed any references to it in the scripts and it still causes the bug.

Any ideas?