You’ll have to give more context, but I’m assuming you’re scrolling the sea sprite? If it’s just the same image moving, consider using a tiled sprite and changing the x-offset to “move” the sea. It’s a lot less work and hassle than moving 2 sprites around in synch.
It Doesn’t seem to work.
You’ll have to give us more to go on. Screen shot the events for a starter, and maybe explain what you mean it doesn’t work - does it go the wrong way, does it not scroll at all, does it scroll at the wrong speed?
But give us screen shots to work with.
That’s in a beginning of scene event. It only gets fired off once.
You want to use a variable (I named mine CameraX) to keep track of the scrolling layer’s camera’s X position and change the offset with the camera change in X position. This will do what you’re after:
which type of variable
Think about what it’s used for - to keep track of the scene camera (that in itself should be a big clue). The value in this scene does not impact or affect another scene, so make it a scene variable. And it’s a number.