[Solved] Make Bottom Limit for Camera

i’m making an endless up runner. i want the player to die if they fall to the bottom of the screen. how can i make my camera stay on the player as they go up, but not as they fall? that way, they can die if they go below the camera. thanks in advance

You can use camera limit Camera limit from (0,0 to x,y) x and y are the far in your stage or level.

Then center the camera to the player and add some condition like if player.Y() > your y the same y you set on camera limit then stop camera to be center on the player.

Other option without the camera limit is for you to check the player.Y() > Y where Y is beneath your floor

1 Like

there is an endless up runner template in GDevelop. See how it is implemented.

1 Like


how would i fill this portion in? this is the “set camera within boundaries” event

Usually is 0,0,max X, and max Y were the last two values are the farthest of your level, for instance in my games I add an extra sprite at the end of the level so when I set up the camera limits use that sprite
Sprite: last_camera_y
Like:


So the event is:

Always start at 0,0 and place the last_camera_y at the end of your levels

2 Likes

thanks for the in depth response, i really appreciate it.
in my case, i’m making an endless runner that constantly centers the camera on the player.

where would i put the “last camera y” object in this instance?

it’s not the same implementation. in the example you’re referencing, the camera slowly moves up regardless of the player’s position.

the camera in my game centers on the player’s y position, whether they’re going up or down.

i only want the camera to follow the player when he’s going up. think of the camera in a game like “doodle jump.”

Instead of that event (maybe floating somewhere), change the y position of camera to Player.Y()

1 Like

the camera is already set to follow the Player’s Y position. the issue is, i only want it to follow the player’s upwards movements.

I tested it and it works… Set a variable ( CamY in my case ) to be the Y position of the Camera and add a condition to the camera that only when the Y position of Character is less or equal to variable camY to follow the character.

That’s what will happen. If you set the Y position of your camera to your character.Y() like @MeX1Co, you will get your result.

worked like a charm. thanks!

Glad I could help… good luck with your game…

1 Like