• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

 [Request] Tile Layer View Based Parallax

When you attempt to move backgrounds or tile layers (not exactly sure how it works in Studio 2 yet) based on the change in view position to create parallax it's always 1 frame behind, and the same thing happens if you move backgrounds according to the view instead of drawing them yourself at a position according to the view. The jittery parallax is most obvious when the background layer is "far away" and you are moving fast.

Background parallax isn't super easy because in a large room to make it efficient it must not only start drawing and repeating near the view, but still has to move, using things like mod and other stuff to deal with resetting draw position. I wish this could just be set in the room editor in the Background and Tile tabs like how auto scrolling can be, but it's even more necessary to make non jitter parallax scrolling with tile layers possible.

Tile Layers are worse this way since you can't just draw the whole title layer yourself at the position you want to. Even when we had tile_layer_shift(depth,x,y) in GM Studio 1.x you still couldn't draw it yourself so the movement is still a frame behind the view movement.

If there isn't a way to parallax tile layers without the jitter in Studio 2 I'd like that to be added. It would also be helpful if parallax scrolling could be set in the room editor. Even if setting it in the Background and Tile tabs isn't added please add something to parallax tiles without the delayed movement. I'd really like to make view parallaxing title layers to add a lot more background variety to scrolling levels.


Friendly Tyrant
Forum Staff
Ummm... parallax can be done as always in GMS2. Just offset position by a scalar amount and it should work fine. If you are seeing issues with delays or whatever you should post any code you use and the events you use it in and we'll see if we can help. Note that the resolution of the game will also make a difference, as low res games will be more obvious in their "jumping" as you don't get sub-pixel movement (unless you scale the app surface to be larger than the game res in which case you can).
Ummm... parallax can be done as always in GMS2. Just offset position by a scalar amount and it should work fine.
At least in previous GMs the view changes position variables after moving the background coordinates, but if backgrounds are drawn in a draw event they take the new coordinates the view has, not the old ones, and that fix couldn't be done with tile layers. I've looked in the manual but can't find the specific code to adjust a background layer's xy position now that the background functions are removed. I know they're sprites, but how do you refer to them if they're a background layer. Backgrounds aren't objects. Tell me the code for moving a background layer in game, and I'll test this in GM Studio 2 to see if this is still a problem.
Okay, it looks like there is no function to set the x/y offset of a background layer, which I thought there was. I'll file a bug about that myself, but in the meantime use an asset layer not a background layer and then the asset functions: http://docs2.yoyogames.com/index.html?page=source/_build/3_scripting/4_gml_reference/rooms/sprites/index.html
I found a way to do the tile layer parallax scrolling without the jitter. If I put the code in the Draw Begin event it does update to the new view position correctly. If I put it in any Step Events, or any other Draw Event it doesn't update to the right position in time (1 frame behind). Drawing sprites updates right even in the regular draw event. Don't know why this is, I doubt newer user would figure it out, but there is a way to do correct parallax scrolling with tile layers using Draw Begin. I didn't know that, but glad I'm know it now.