Make scenes persist

I’m sorry but I can’t seem to figure out how to save scenes, so that they don’t reset. :I

I’m trying to figure out a sort of unlock feature, you buy a worker you’ve clicked on, and their icon would go to a location and stay there

but when I click to return to the homepage the scene resets, but the variable has been activated still so I can not add it to the slot location again.

Not really sure what are you talking about mate, but are you using scene vars or global vars?
At the first look it seems you are using scene vars. But if you want to go through scenes then global vars are the right option.

Im really dont get that “make scene persist” 'cause the moment you have a scene, well, the scene stays there no matter what (unless you make a couple of events in order to change it). :slight_smile:

The variable charslot1 is global, and it stays activated when I leave the scene, but when I exit the scene to go to the home scene, the common object(which is global if that matters) returns to its start position, and disappears from where I put it.

By scene persist I meant when I change the scene(move the common object to the slot object) I want it to stay there when I go to home scene.

Can you post the .zip or .rar file so i check that out?
Im not the God of GD, far from that really, but i find this very interesting. That .rar or ,zip file, please? :slight_smile: (5.42 KB)

You .zip file is completely useless., noting there…
Are you under Native or Html5?

Sorry about that, I opened it and it worked for me, not sure what that is about :I

Uhm I don’t know the difference or how to tell, I literally started using it yesterday and I’m not a coder or anything of that nature. The file is a .json if that helps.

GD lets you pause a scene before switching, with the action “Pause and start a new scene”. If you use it, the paused scene state will be stored in the memory, then you can use the action to go to the previous paused scene (the action “Stop and go back to previous scene”), the paused scene will be resumed.

EDIT: But for complex scenarios, I think you’ll need global variables anyway :neutral_face:

Sorry if double posting is allowed, but I had an epiphany and thought I should update for anyone that is looking for something similar!

I changed my whole way of thinking about this and instead of moving the object decided to make the object already there with layers then activate it with global variables and layers! I feel really silly but I am glad that it works now.

Oh thank you for your reply, Ill see what this can do! I have just been using “change for scene” I managed to get something working for now.

There you go! :slight_smile:

Im using that functionality in my game, as Lizard just said. Esc key (or whatever key you want)- go to a new paused page. Hit enter or return key and you get back into the game. it’s easy!

Thanks! and very cool I’ll need to check that out, probably will be using.

How did you used Esc key? (i can use any key except Esc key) :confused:

I have modified platform game to test switching screens. The main screen of the platform game is called “New scene”. During half way of the game, I manage to use “Pause the scene and start ‘Bonus’” where Bonus is the name of the second screen.

On the second scene - Bonus. I put a sprite to trigger the event “Stop the scene and go back to the previous screen”.

The Bonus will close and screen switched over to “New screen” but it did not resume from the last position instead started from new again.

Could someone help to to make the game resume after switching? Thanks in advance

That should work, maybe there are other events messing it up, can you share your modified example? :slight_smile:

Thank you very much for your prompt reply! I have it in my office PC. I shall attach it immediately once I am back in office.

Do you think is it possible for me to provide some pointers or website with more info on scene swop?

I can’t give you a link to the wiki because it seems the feature isn’t covered, but here is an example that uses this function to teleport the player around scenes: [url]How to? Link scenes say by walking sprite through a door]

I have attached the zip file.

Thanks in advance.

You must delete the object “Question”. Change to scene Bonus AND delete the object Question. Otherwise happens a loop between both scenes.
Also, in the Bonus scene, i think you just need one action, the “Stop the scene and go…” and not the other action you have there.