Parallax2D and Prefab Rooms

Godot Version

Godot Engine v4.6.2.stable.steam [71f334935]

Question

I’m working on a 2D Platformer and am having some trouble with the Parallax2D node’s Scroll Offset.

Recording 2026-05-22 at 12.50.14

Here I have a working example of what I’d like to accomplish. In the background there are 2-6 ParallaxNode2D’s at varying Scroll Scales. Some of them are just simple images, but the boxes are set to repeat and autoscroll, giving the feeling of a factory in motion.

The project is set up to have individual scenes as “Rooms” that get stitched together into a “Level” as depicted below. Here we can see the above room on the far left, and two additional rooms adjoining it to its right. It’s set up this way to make changes to the level’s overall structure quick and easy, and to be able to quickly test an individual room by itself without any of the overhead getting in the way. As such, the Parallax2D’s are stored inside the Rooms.

If you’re familiar with Parallax2D’s you’ve probably already spotted the issue. A Parallax2D node would visually look fine when testing the individual room, but break as soon as you place it into a level due to the positioning of the room in world space.

for p in e_parallaxLayers:
    p.scroll_offset = Vector2(global_position.x * (p.scroll_scale.x - 1), global_position.y * (p.scroll_scale.y - 1))

Thankfully it’s easy enough to fix with a little bit of reverse engineering on how the scroll_scale works. When a Room is entered, manually set the scroll_offset of the Parallax2D to a value based on where the Room is inside the Level.

This reveals, however, the real problem I’m having: This solution only works for Parallax2D’s that aren’t set to auto-scroll. Above is the third room in the sequence (with a portion of the bg cut out so you can see better), with the moving boxes AWOL.

When autoscroll is set up, the Scroll Offset is constantly being overwritten (even though it says it “will not be overwritten” which confuses me) by the auto-scroll system.

Is there an out-of-box solution to this using the existing Parallax2D functionality, or should I instead be looking at other solutions?

Off the top of my head I could probably just whip up a simple texture-repeat shader that offsets itself, or even just animate the belt, but I wanted to ask for help because it sort of seems like a bug based on the documentation? Or maybe my understanding of the node is simply just wrong, it’s hard for me to say? Regardless I’d appreciate any help with the problem. Thanks!

I would try creating a Viewport at the Room level and put the Parallax2D nodes inside that.

Good call out on the docs. I think that property description was written before we added autoscroll. It indeed is internally updated when you have autoscroll on, but is based on whatever you had originally set.scroll_offset is mainly for when you have your texture set at 0,0, but you want it visually offset when the scene runs. So, if you had scroll_offsetset to be offset by 500px to start, the autoscroll will start from there and then wrap when it hits the repeat_size edges.

screen_offset is always internally updated based on camera movement unless you have follow_viewport turned off.

If you want “infinite repeat” but also sectioned off, you can put your Parallax2D in a Control and turn on clip_contents(or whatever it’s called). Keep in mind, the Parallax2Dshould still be at a global 0,0, so if your Control is at 500,500your Parallax2D should be at -500,-500