I’m working on creating 2D rooms with multiple parallax layers (furniture, walls, windows, etc.). I’ve set up two ParallaxLayer2D nodes, and they work as intended.
Is there a way to make Layers 1 and 2 visible only in their respective rooms? I tried using a Sprite2D with the ClipChildren (Clip Only) option as a parent node, but it only works with other sprites and doesn’t affect parallax layers or canvas items. Also I’ve tried to use Viewports for each room but ParallaxLayer2D did not move with the camera.
Is there a way to hide Room 1’s layers when the player is in Room 2 without manually managing the visibility based on the player’s position? I’d prefer to avoid that approach since it feels clumsy.
I’m not entirely sure what you’re asking, but if it is what I think it is, you can just place the room extents in a Control and set it to clip contents. The only drawback is that Control nodes currently don’t work with clip contents when rotating.
I assume you’re using an older version of Godot? Parallax2D is a built in node in 4.3+, where ParallaxBackground and ParallaxLayer is deprecated, so that would be a better way to go.