Platform is not endless

Hi everyone, I’m a fresher and try to create an endless runner game. In preview, I have a problem about making the endless background and ground that I can’t solve although I find it on google. The player always falling out although the ground and background is endless.
I use smooth camera extension and set smooth camera behavior for player object. In event tab, I set Image offset X of background and ground objects : add(100 * TimeDelta()) . This is my preview :

https://drive.google.com/file/d/1RiEivGx_nFPhrZK07Z-Zjc4DY42RHWzG/view?usp=drive_link

Here’s an explanation of how drawing a sprite from an offset works.

Your issue is that your platform sprite doesn’t move with the player - the platforms are stationary while the player moves. As the player moves, the camera follows. Because the player is moving while the platform is stationary, the player drops off the end. The only thing changing with the platform object is how it is drawn within it’s own bounds/border.

If you use the offset technique, then you don’t move the player left and right. And you don’t change the camera’s position. What you do need to move are all the other objects in the scene.

I suggest you create a new game from the “Run Dino, Run” game template and look into the Game scene and its events (to get it, in GDevelop click on File → New → Project from template…, and search for Run Dino Run). Understand how that works, and you’ll be able to fix your game.

1 Like