Make rooms not reset when the player leaves

I’m not sure if I’m explaining this right, but I’m making a platformer games where the player travels between rooms. Right now, when the player moves between rooms, everything in the room resets. I think I need to program some kind of way to save progress or global variables, but I’m not sure.

I’m open to any advice!

If each room is a separate scene or external layout, then yes, you’ll need to store the information of the room’s objects as you exit the scene.

One way would be to put all the objects that can change into an object group. Then store only the important info (some or all of object name, position, rotation, scale, colour and whether if it was deleted). Then when you re-enter the room, got through the list and recreate the objects.

1 Like

Thanks, Mr. Men. I’m going to try that out. I also found this tutorial to help me get started.

GDevelop - How to Save and Load your game or create checkpoints in Gdevelop5 (GDevelop5 Tutorial) - YouTube

I’m not labelling this as solved just yet. This looks like a multi-step process, so I’m gonna take my time to solve this. The thread is still open for everyone to comment on, of course.

I did a simple thing for my prototype. I have two scenes. In the first scene there are 3 objects that the player can pick up: a crowbar, a book, a banana. When the player picks one up (collision and button press > object is deleted from the scene), a variable -‘hasBanana’ - changes to True. A banana icon appears in his inventory.

When the player enters the second scene, the banana variable is checked and the banana will be in the inventory if it’s True. When the player goes back to the first room this check also happens and the banana will not be created for him to pick up a second time. All of this stuff just uses my ‘hasBanana’ (or hasCrowbar etc.) boolean.

I’m not sure how I would handle things if my game has, say, 100 unique collectibles. 100 global variables to track them would be unwieldy. I’m sure as I learn more about GDevelop I will encounter a better way of handling large numbers of collectibles.

1 Like

Just as a suggestion for your future self when you get to the 100 objects :grin: :

Use a structure (it’s a dictionary type key-value pair list). Use the collectable item’s name as the Key value, and true/false for the “is-in-inventory” indicator as the Value part.

1 Like

Wonderful, thank you. I did a beginner’s Python course a few years back and dictionaries sound familiar. I’ll have to figure out how a structure like that works in GDevelop, but I get what you’re suggesting and I hadn’t thought of it before. Thanks!

1 Like

So, I’ve been going over and debating exactly what I want to do in terms of saving and loading features.

  • A Load Game page in the main menu with save files
  • Checkpoints
  • Room borders for the camera, maybe

Things I want saved with a checkpoint:

  • the player appearing close to the position from the door of the room they came from
  • Inventory
  • character interactions, when I make more.

Working on this now. Though honestly, it’d be awesome if I could just create a Save Game option in the pause menu and everything including the objects and player position could get saved.

Okay, Idk what I’m doing.
I want the player, when changing rooms, to spawn close to the door (RoomChange object) and it’s not doing that. It’s spawning in either the checkpoint position when entering a new room or spawning at another position.
Here’s the code for Scene 1 the Secret Office, Scene 2 the Mansion, and the checkpoint event:

I think you’re dealing with saved Position values in the Mansion events round the wrong way.

From Secret Office events, Position = 1 for Checkpoint, Position = 2 for Room Change :

But, in the Mansion events, Position = 1 (a checkpoint) seems to be treated like room change :

while Position = 2 (a room change) is treated like a checkpoint :

Or am I misunderstanding things?

You didn’t misunderstand, I think my programming is just too messed up.
I found another save and load tutorial that uses global variables, so maybe this one will be more successful.

Okay, I think I’m on the right path now and got a foundation. I’ve been able to make the checkpoints work when Player dies in a room, but I need to see how I can innovate on that.

This is what I’m aiming for:
Room A has the checkpoint and Room B has the hazard.
If player touches the checkpoint in Room A, but dies in Room B from the hazard, they’ll respawn in Room A at the checkpoint.
The events that the player has done before touching the checkpoint haven’t reset.

Right now, the player will only reappear in the same room they died, so I’ll need to think about that.

Also, here’ the tutorials that helped me:
Saving & Loading (Storage) - Advanced Tutorial - GDevelop - YouTube
How to Make a Checkpoint System in Gdevelop5 - YouTube

Some observations :

  • you should be saving the checkpoint position (last event of the screen snip) as a subevent of the previous event. Otherwise GDevelop won’t know which CheckPoint object to sue if there are multiple CheckPoint objects in the scene.

  • And when BigDiablo is dead, change the object’s position to the save value, not to the position of a random CheckPoint in the scene

So you’ll need to save the check point position and the scene name.

… I just remembered that I had the Checkpoint Extension installed. :flushed:
I’ll see how I can work with this and make an update.

The checkpoint extensions helped to clear up a glitch, but it still hasn’t helped me let the player change rooms when dead to reach their last checkpoint. I think I’m starting to figure out how to do that and I think it has something to do with playing around with global variables and the Change the Scene mechanic.

Almost success!

When the player hits the checkpoint in Room A and dies in Room B, they respawn in Room A as intended. I was able to do this with the Checkpoint Extension and a few Global Variables.

One little glitch that remains is that I haven’t figured a good way to program the Boolean of Saving.Dead to false after the player dies and respawns. Because of this, after the player dies and respawns, anytime they reenter Room A (Secret Office), they spawn from the checkpoint area, not from close to the door. I tried to make another sub event in the Checkpoint external event, but that screwed with the rest of the code by not respawning the player at the Checkpoint object at all, dead or alive.

I think I did enough right now to take a break and work on another aspect of the game. Everyone is free to leave their thoughts, but it might be a couple of weeks before I swing back to working on this.

I still haven’t completed the primary goal of making the rooms not reset, yet. :sweat_smile:


Me and a friend Lucky-J figured out made a template to create a game with multiple storage slots, checkpoints, and saving in a simple game. Here’s the downloadable project so others can use it.

Multi-Scene, Multi-Save by Mx. Shade (

1 Like