What is the best way of implementing checkpoints in a 2d game similar to New Super mario bros U ?
When the player collides with the checkpoint, store the number of the checkpoint
Then you can play a little flag up animation
When the player dies, look up the position of the checkpoint and teleport the player slightly above that, reset their health and dont froget the reset rotation and move the camera and play the jump animation
Thanks for the answer ! It is exactly what I needed.
On top of that, when i enter the checkpoint, i have to store the number of starcoins collected and their locations.
I have another question though :
When player dies, is it better to teleport it to the checkpoint, or to reload the scene at checkpoint position ?
Depends on the contents of your scene.
If the scene contains parts or puzzles that are one-offs, you should reload to save yourself the work of placing all of them again.
On the other hand if it’s just the player and pre-animated obstacles it’s easier to just teleport the player, because reloading the scene might have some unintended consequences.
Thank you so much !