Save Variables for later use?

I want to make a game where it saves which level your on, so basically my concept is to have it create a file and store the level variable in it when you complete a level, if the save file already exists it overwrites it, and when the game starts it loads that file if it exists and assigns its value to the level variable, how would you go about doing this?

Thanks for any help!

If you just want to save a number indicated which level the player reached, it is quite simple : You have basically to use the action “Write a value” in the theme “XML files”. You just have to enter the filename ( savegame.sav for example ), a group where the value will be save ( It can be for example CurrentLevel ) and finally the value ( For example Variable(CurrentLevel) if you have a variable named CurrentLevel which is used to remember the level of the player ).
To load the value, use the action “Load a value”: Enter the same filename, the same group, and the variable where you want the value to be loaded to.

If you have more complex needs, you’ll have to register each variable or each information using these actions.
You can also take a look at AdvancedXML extension ( There is an example called CreateXMLFiles.gdg using this extension ).

Thank you very much, works great!

AES encryption is neat, certainly fixes the easy modification of XML files! :smiley: