Scrolling Engine

Does anyone have a scrolling Platforming Engine? I don’t know how to make the platforms go at the same speed and stuff without making a scroll variable which I don’t know how to add and still have physics.

There are two ways to do this. Either you move all the scenery to keep your character in the middle, or else you move the camera to follow your character (and keep it in the middle).

The demo program Lua jump uses the second approach (to go up and down rather than sideways). It’s really, really simple. You use the translate function to move the drawing origin . Here’s the relevant code from that demo.

-- Center the camera on the girl character
camPos = vec2(WIDTH/2, math.min(HEIGHT/2 - girl.position.y, 140))

Thank you so much. But it’s not completely centering on the player. The player is moving too.

Well, you can use this technique to centre it anywhere you want

@EpicPotato this thread shows you one way of doing it