Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How do you add checkpoints in a 2D Platformer, in Godot?

A topic by Danielle's Games created Dec 21, 2021 Views: 859 Replies: 1
Viewing posts 1 to 3

I've watched several Tutorials on how to add checkpoints, but when I tried adding the code, as well as using a singleton, it hasn't worked.  Also, I have it set up so that when the Player runs into an enemy, or falls off the edge, the scene restarts.

Does anyone know an easy way to add checkpoints?  

Moderator moved this topic to General Development
(1 edit)

If all you want is for the player to respawn at the last checkpoint that she touched, you can simply store a value for the player’s position every time you touch a checkpoint (using some kind of trigger in whatever game engine you’re using) and then when the player dies move her back to said stored position.

This does have the implication of if the player reverses back through the level, they will still respawn at the last checkpoint they triggered, not the one closest to the end of the level. This could be intended behaviour or not, depending on the game you are making.

Edit: missed the part where you said you were using Godot. You can detect collisions with a checkpoint trigger by creating an Area2D node and having a script on it with the _on_Area2D_area_entered function overloaded. From this function you can set your player’s (a global, maybe?) last checkpoint position.