- Home /
Checkpoint system in platformer
Hi,
I would like to ask how to create a checkpoint system similar to Crash Bandicoot. More specifically I would like to mimic this sitiuation:
Player activates checpoint making new respawn point.
Player goes futher in the level, collects items etc., but he loses a life before he reaches next checkpoint.
All items that were collected after checkpoint activation are lost and respawned in the level(in Crash examle those would be crates, enemies and woompa fruits).
I drag&drop my items on the scene as prefabs. Simply put I would like to save a state of my scene and revert to it after death. Any suggestions? :)
Answer by Joel_Ruiz_WV@yahoo.com · Oct 03, 2013 at 06:25 PM
There are many ways to handle this situation, you could have an array of transforms called "CheckpointsList" of your checkpoints. Then create an int named "Checkpoint"of which checkpoint your character will respawn at. And when he collides with your checkpoint plane change the "Checkpoint" int to its value plus one. So when he dies you can destroy the current player, and instantiate him at item "Checkpoint" of "CheckpointsList". To retain all items he had when he touched the Checkpoint platform, I would create another array and add a list of objects he had named "ObjectsInInventory". and when he touches a new platform, make sure to delete all the contents of "ObjectsInInventory" so there are no duplicates of objects he had already. Hope this helped if you need any scripting references comment. (:
I have no problems with scripting, only with concpets. I was thinking about similar concept actually, but I was hoping it'll be less compilcated in Unity... Like it has some magical built-in 'save state'/'load state' methods.
Your answer
![](https://koobas.hobune.stream/wayback/20220613115243im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
simple checkpoint/save/load system in javascript 4 Answers
System.IO in javascript 1 Answer
Unity 3D 2018.1 - Save 0 Answers
Suggestions for Persisting Items' and Enemies' state between Load? 5 Answers
Checkpoint with PlayerPrefs 0 Answers