I’ve noticed that lots of people are using this as a way to help them with saving. For those who don’t want to or can’t download the game, I’ve taken some screen shots of Multi-Scene, Multi-Save:
I can’t guarantee that this is the best way of creating storage, especially as GDevelop updates, but it could give an idea of what it can look like. If I find better ways to create storage for a game, I’ll make sure to make a thread for that.
The variables CurrentRoom and LastRoom help us program the player changing rooms
SaveSlot, SaveSlotName, and DeleteSlot are for the storage, saving, and loading data
Health is health
CheckpointX, CheckpointY, and StartAtCheckpoint are for programming the checkpoint stuff. The last one tells the game if we need to spawn at the checkpoint’s position when we enter a room or not.
Save1 is the Parent that needs to contain all the things we’ll need to save when we hit a checkpoint in-game.
The menu’s script. Press the button and it takes you to the next scene, Load.
This is where you can start a new game, access a saved game, or clear a game file. I included a screenshot of the scene itself.
At the top, you’ll notice a Sub-Condition at the beginning of the scene to convert a JSON string and store it into a global variable. You’re essentially loading a JSON file to a variable. When we access this variable, we access the contents of the JSON file, which is the game.
Going into the programming of File1: When you press one of the file buttons, you’re
- changing the name of the global variable to indicate which button opens which storage (there’s 2 for this game)
- we’re taking the data from the variables in Save1 from the chosen storage and putting it in a Scene Variable called Savespot. You need to have this variable for every scene that has a checkpoint.
- Setting the variable StartAtCheckpoint to True.
Finally, there’s the Clear data option. When you press the ClearButton (the X button on the screenshot), it will store the data into another global variable DeleteSlot and then delete that. This way, you can save, clear, then resave the data on that file.
Make sure the Player Extension is linked to every room, regardless of whether it’s a scene with a checkpoint or not.
This is a game that starts with the player not touching a checkpoint yet. The object Marker is to mark where the player starts when they’re starting a new game. We also set the StartAtCheckpoint Boolean to False because when we start a new game or change scenes, we don’t want the player sprite to change position to wherever the checkpoints are.
Similar to Room1, but since the player doesn’t spawn here at the beginning of the game, there’s no need for a special Marker.
Saving the Game at Checkpoints: This is the part where I tell the game what Global Variables I need to change and update. You’ll also notice that I have a sub-condition that deletes the storage in that save slot and then another sub-condition right after that resaves the data. This means that every time the player activates a checkpoint, the global variables will update, the old data is deleted, and the new data with the updated global variables replaces it.
Player dies, Reset to Checkpoint: When the Health reaches 0, one of two things happen. Either you’ll change scenes to the data you have on the file, or you’ll go back to the checkpoint position if you’re in the room where you saved.