Vertical Parallax 2D Sidescrolling



I'm having issues trying to get a good looking vertical parallax. I notice most people just do
layer_y(layer_id, y/speed);
but this doesn't really work very well, unless your room height is pretty much always the same, sort of a Super Mario level.

I'm trying to achieve a result where if I have big room on the vertical axis, the backgrounds are relative to their original positioning, so I can create a different "heights" feeling. Imagine a tree. You see the base of the log if you're at the bottom, you see the middle of the tree if you're at the middle, and you see the top if you're at the top, so it is clear what I mean.

Currently what I have is achieving this, sort off:

var _ypos = camera_get_view_y(cam) /(room_height-camera_get_view_height(cam));
There are two problems:

- One, if the room is smaller than the actual background, if you jump it would scroll super fast, when it shouldn't scroll at all.
- Second is I don't have different depth scrolling on the vertical axis, as they all move the same. I've tried adding bigger buffers to different layers and it does somewhat achieve that feeling ,but not quite smooth.

I know this is very specific, but if anyone has any idea on how to fix this I'd be super happy cause I'm hitting a wall.


i don't really have an idea to fix your issues your having, but as an outthere idea, maybe consider your cameras movement to the player position in the ROOM, instead of the the player. like if the player is at a particular level line then the camera will move if not then it wont, does that make sense? i dunno. good luck with it either way. :)