How Checkpoint works?
Hello everyone... I'm developing a 2D plataformer game on Unity, and my question is: How work the checkpoint system on the other games?
Because I've already done the checkpoint like dying, and respawn on the checkpoint position, but what about the monsters I killed? and some puzzle I started to do... I can't just reload the level, because I can't reset monster and puzzle that I've already passed before the checkpoint. I don't know if I was clear enough... Sorry my bad english and thanks!!
create a vector2 and update the position once you got to the checkpoint (OnTriggerEnter2D). Every time you re spawn, you make the player's position to the vector2
@SoloDeveloper , Thank you for your reply, but you didn't understand.
I know how to do it, but I can't only move the player position to the checkpoint. What about the scene? Enemys that I killed, or puzzle that a started to pass, must be reseted, you see? I could reload the scene, and move the player to checkpoint position, but the problem is what I've already passed. Everything will reset, but must reset only from checkpoint forward.
Answer by awest · Jun 21, 2016 at 04:43 PM
Typically a checkpoint does reset the puzzles and monsters prior to that point. It uses an object with Don'tDestroyOnLoad to save a couple variables like position, point, lives, etc. That would allow you to reload the level and keep important changes. The games that use this method usually don't require the player to go backwards.
You could add in booleans to the checkpoint system and have puzzles/monsters check their state at the start, but at that point you might as well implement a game saving script. It would collect data and export it to a textfile that could be loaded back in at the start. I've used this in the past. It's good for most cases, but if you're into coding I would recommend writing your own. Saving and Loading data
@awest, Thank for your reply...
I was thinking on save this variables, and reload the scene, but the problem is that player can't go backward. As I understand, If the player could go backwards, I'll need to have scripts to control the state of puzzles/monsters, and them reset only what is after checkpoint, that what you meant?
There are many ways to save things. I was just suggesting a couple options with helpful links. I would recommend watching the video tutorial "Saving and Loading Data." That should give you more specific advice so you can decide which method is best for your game.
Ok, It will help me a lot. Thank you for your patience and attention! :D
Your answer
Follow this Question
Related Questions
Respawn point 1 Answer
Death Countdown Area 0 Answers
Reset rotation of gameobject 1 Answer
How do i put "Wasted!" after respawn? 0 Answers