I'm making a game with checkpoints, and I want to restart the game(or reset the layout) after the player dies, but I want him to respawn at the checkpoint if he reaches one.
Set a global variable upon reaching a checkpoint.
On start of layout, check if global variable is set. If it is, position the player object accordingly.
Use Local Storage to persist across play sessions.
Develop games in your browser. Powerful, performant & highly capable.
It worked, Thank you.