Posted June 20, 2021 by Imogia Games
#platformer #2d #indie #devlog #tech #technic #explanations #tuto #checkpoint #mechanics #gamemechanics #timedust #imogia #imogiagames #python #gdscript #codeexplained #godot #gamedesign #indiedev #gamedev #1gam
A real quick update, as I continue pushing forward to make a new game!
I already did the Checkpoints stuff back in my game Moonie for the Nokia3310 Jam.
However, I forgot a lot of stuff haha, so I had to remind myself how to do things.
The key here is obviously to use an autoloaded singleton to which I send the respawn pose each time a Checkpoint is activated.
On the object Checkpoint itself, there is an area 2d that will only the detect the Player. If Player is detected, then the Checkpoint becomes active and sent its coordinates to the singleton.
For as long as the singleton's variable match the checpoint's global_position, it remains active. If it's different (in case a different Checkpoint is activated), that checkpoint returns to be inactive.
For cosmetic, I added a Position2D node as a coordinates reference point for respawn. It's slightly more elevated that the checkpoint itself, so whn the Player respawns, it spawns at the top of it, then fall into the ground.
By the way, go check Rafa Fieno's video on checkpoints, this guy nailed it, it's a lifetime saver: