Issue with changing scenes

Hello. I am trying to figure out how to save the player location when I leave a scene, and have it remember that location when I return to the scene. Here are the two actions that I have set up on both scenes.


I have an object that can be interacted with that, depending on the object veritable, will change where you go. Or at least that is the idea. I can go from the lobby to the overworld, but from the overworld to the lobby is the issue. Instead of changing to that scene it just puts me back at 0,0. I have tried the trigger once on both and neither seems to work

So, what am I doing wrong?

(I think I should note that changing scenes works, but the location saving does not. That is the issue I am having. It puts me at 0,0 every time

Nevermind. it will take longer, but i dont have the issue if I the ‘alert box’ to individual sprites. It will be a bit more work, but this is for a jam, so I don’t have a lot of time to trouble shoot these issues.

why don’t you just use save/load storage with a few lines

So, the reason I did not do it that was was because… uh. well, I have not thought of using storage outside of saving the game before. Once I have more time I will definitely look more into that!

Or perhaps use a global variable instead of a scene variable for saving the position. If saving the position of multiple scenes, use a structure variable.

2 Likes

This is what I ended up doing. There is a structure with an xchild and a ychild for each room that needs it (rooms with only one door do not need it), and I removed the ‘store current location’ idea and instead just put actual coordinates. The reason for that was because, since there is no default ‘action key’, I had to make a variable that changes when it is pressed in order to have multiple control options (the game can be played with the WASD, arrow keys, or x-box gamepad). What would happen was, since the location was always inside of the activation area, it would SEEM to not work, but in reality it was rapidly flickering between scenes and ending up on the original. Making the coordinates outside of the zone by 2 pixels solved the issue