I wanna know how to save and load the progress of the game and I know nothing about XML. Can someone provided video tutorial for me?
I wanna save something like:
player’s X,Y,Heath,armo,ammo,items slot etc.
Enemy’s X,Y,health,target (where he is going), weapon etc.
I’ve just answer about storage, here: [url]https://forum.gdevelop.io/t/how-to-save-progress/11344/5]
It’s the same for XML files (native games), but you have to check your written file with a text editor, instead using the browser tools (HTML5 games)
Then you just have to save those values in an appropiate group, for example, save Player.X() in “main/player/pos_x”.
If there are multiple enemies, you’ll have to write some extra events to get a functionalized save system, you’ll have to loop over every enemy, and save it in a different group. There is an example in the Examples folder that does it (“Level editor.gdg”, I think), but anyway it should be something like:
Do = 0 to variable "ID"
For each "Enemy", repeat:
Write Enemy.X() in "main/enemies/enemy"+VariableString(ID)+"/pos_x" of file "save.txt"
Write Enemy.Y() in "main/enemies/enemy"+VariableString(ID)+"/pos_y" of file "save.txt"
Write Enemy.Variable(Health) in "main/enemies/enemy"+VariableString(ID)+"/health" of file "save.txt"
Do + 1 to variable "ID"
As the variable “ID” is increased (and different) for each enemy, and I use this unique variable in the group name, there will be a different group for each enemy
Thanks, I’ll give it a try.