• Register
Post feature Report RSS Checkpoints & SaveSystem

Implemented checkpoints to the game and a save system to save the times of the player.

Posted by on

Hello, everyone !!!

Today it's a quick article. What I implemented was a checkpoint system as well a save system.

For the checkpoint system what I do is put gamobjects in the scene and then I drop them into a script, where they go through that list and spawn a prefab called checkpoint.

CheckpointScript


CheckpointCode

CheckpointPrefab

The prefab contains the script Checkpoint. This script contains the method OntriggerEnter it's called when the player finally reaches the checkpoint.

CheckpointScriptCode

If the player is in the last checkpoint the material of the prefab changes

FinishLine

When the player reaches the last checkpoint, the game finishes and the time is "saved" into a list on the GameManager, the GameManager organizes the list and sends it to the SaveManager to be saved into a JSON file.

SaveToJson

JSONSaveTimes

Of course, I also implemented a Load method that is called at the beginning of the game

LoadMethod

And that's all for this week.

Don't forget to follow me on X.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: