Godot 4.3
Hi! I am working on a 2d platformer with mainly vertical camera movement and have an issue with the new Parallax2D node.
The way my the game is currently structured is that the player is followed by a static camera per room. Whenever the player moves down to a new screen, the camera assumes its new position. At “special” rooms, the camera switches to one that is a child of the player. These rooms are vertically more than one screen high, so the camera follows the player dynamically through the room. All rooms are in the same scene, and I want to keep it that way.
I want to have a static background for the static rooms (I currently have this implemented with a Tilemap which works perfectly). And I want the background to be a Parallax2D during the bigger rooms.
Now for the issue:
I cant seem to find the logic behind the position of the parallax layer during playtime relative to its position in the editor, its own scene, etc.
I have tried experimenting with the limit function of the parallax, which seems very logical (have the sprites be static and out of view until the camera enters the room). But the limits never seem to stop displacement of the sprites.
I have tried instantiating the parallax only when entering the room, but also then the parallax was at very different coords, than the given global position.
I’ve read that it’s based on either the origin or camera position, but even when I put the parallax at the same place as those, it buts all the layers in different places.
I would love some help with this, since it’s been hours of testing stuff and reading the docs without any progress.
Thanks in advance! (This is the first time I asked a question on a forum like this myself so if you need any more informaiton please ask!)