[Solved]Prevent up/down scrolling on certain layers

I have a few layers in each scene, and in a global variable file I have the following events so that the background layers move at various speeds creating a parallax effect:

On the level itself I have the following code to following the player (Ozzy) within the dimensions of the level (this code is on the level itself because each level is a different height/width). I also offset the camera 200 pixels so that the player is not dead center, but slightly off to the left.

Everything was working great when the level just went horizontally (when the cameras y limit was 0,0). I am now implementing levels that go vertically (hence the 0,-3420 above), and I am finding that:

  • the Base layer with the player/obstacles/enemies/etc. scrolls as expected both on x and y axis
  • the background layers do the parallax on the x axis, but when going up/down they do not stay at the bottom of the level and instead there is no y scrolling at all.

I want the y position of these layers to stay the same. I’ve been messing around with the camera conditions/actions for hours now, so I’m turning here for help. Any ideas?

1 Like

This is all just quick guessing:
Your events above do not show any Y scrolling for the cameras on the other layers. (All of your events are “Change the x position” not “Change the Y position” so you probably need to do the same thing you did for Ozzy.X with Ozzy.Y

Your main layer is following the player because you have “Center the Camera on Ozzy”.

Also, you’re probably causing some conflicts as well because you have the camera both trying to center itself on Ozzy AND add 200, so it’s jumping back and forth each frame (internally, if not visibly).

I’d probably just recommend you add a “CameraPosition” object, have an event that is “Position “CameraPosition” object at Ozzy.X() + 200, Ozzy.Y()”, then center your camera on that object. You can then hide the object at the start of the scene.

I will definitely try the CameraPosition object. What layer should that go on?

The answer was staring me in the face: since it was working on the Base Layer, I just needed to do the same to all the layers I wanted it to work on. Thank you for getting me on the right path Silver-Streak.

1 Like

Solved