I’m not sure if I did the coding right. Here’s a screen shot of what I did
I don’t really understand what you did in the second screenshot. ^^;; It seems you’re resetting the position of Player, but not saving anything. The “Do = x, y to the position of Character” is not storing information, just sending your character all the way back to the beginning position.
If you want to write the X position and Y position into the Storage, you need the “Write” actions.
They can be found in “Storage > Write a value”.
Do you see that “Repeat for each Character object” sub-event in the first screenshot? That’s what is writing the information into the Storage file. Without it, you aren’t saving anything.
When SaveNow = 1 in your code, all it does is READ the position from the variable, but not actually save it as it should - because you didn’t add the proper actions.
Drag the “Repeat for each character object” sub-event I just mentioned - the one you see in the first screenshot - and put it below the “If scene variable SaveNow = 1” event, as a sub-event. That should solve the problem.
Also, there’s no need for the “Do = Variable(posX); Variable(posY) to the position of character” there either. You would just be sending the player all the way back to the first-saved position, if not to position 0;0. This is the opposite of what you want, it will be like restarting the game every 10 seconds.
Instead, the actions should be something like:
If scene variable "SaveNow" is = 1
Trigger once
do = 0 to scene variable "SaveNow"
For each "Character" object (subevent)
write character.X() in "characterX" + ToString(character.Variable(ID)) of storage "save"
write character.Y() in "characterY" + ToString(character.Variable(ID)) of storage "save"
This should be basically it. ^v^;; It will properly write what you need in the storage.
Also, no, don’t delete ALL of the “Initialize” section - one of these sections are LOADING information, not saving. It has nothing to do with the “Save” button. I mean, you can, if you want to make your own custom way of loading the scene, but I don’t see a need to.
You can feel free to toggle the events tied to the “Save” button as disabled though, or just straight up delete them if you feel like it. Just don’t delete the entirety of the “Initialize” section unless you’re planning on redoing the loading system too.
I hope this helps.