In the level, I made a set of checkpoints and added them to it, and they work correctly… but after I created the player’s death menu so that it would appear to him and he could restart the game through it… I don’t know how to make him repeat from the last checkpoint he was in. The death menu is in a scene other than the scene.
Create an Autoloads (Globals in 4x) script and store the last check point name or its position while player enter any check point. Then you can set the player position to that check point pos at the start. Like this:
#Global.gd
var last_checkpoint_pos = Vector2.ZERO #or Vector3 if it is 3d
And here is the level script:
func _ready():
if Global.last_checkpoint_pos != Vector2.ZERO: player.position = Global.last_checkpoint_pos
#Add here the function that will store the last checkpoint position in Global.
It’s just the concept codes, you can customise it as you want. But if you are still unable to solve it, then can you describe your scene?
1 Like
Thank you very much, you really helped me. With this simple concept, I was able to fix the problem of moving from one death scene to another checkpoint
1 Like