• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM How to make save-load system

S

SaeedBRI

Guest
I have a badly problem... I made my game but I cant make a save load system on it ... Not a normal one, like a good game... So... If u play a game (like silent age) for your second time, you see the main menu at the first, then if you tap "start" you see... The game saved your progress...
I have 20 levels, and 1 main menu. I want my game to save the levels, but start from main menu...
I mean: for example John is our gamer and he finished four levels, then closed it and next time opened the game and the game started from main menu but when he clicked "continue", the game showed him fourth level.
For your exmples, the names are:
room_main. ........ Room_1. ......... Room_2. ...
Obj_player.
Note:I dont want to save the player's positions.
 

cdgamedev

Member
You can use ini files?

In create event:
Code:
#macro SAVE_FILE "savedata.sav"
ini_open(SAVE_FILE);
global.CurrentRoom " ini_read_real("Game", "Level" Room_1);
ini_close();
Then when the continue button is pressed do:
Code:
room_goto(global.CurrentRoom)
Then, when going to the next level:
Code:
global.CurrentRoom = room;
Then when leaving the game:
Code:
ini_open(SAVE_FILE);
ini_write_real("Game", "Level", global.CurrentRoom);
ini_close();
Take a note;
- I'm on my phone so itd be best if you wrote out this code rather than copy paste
- if you don't understand any of it and therefore, it needs explaining, let me know

Edit 1:
- Made code more efficient. Realised that I had written an overly complicated version of the code
 
Last edited:
S

SaeedBRI

Guest
But didnt you wrong?
Shouldnt we write:
Code:
Ini_write_real
in creat event? Because if we dont write "currentroom" , its nothing I think. No?
 
S

SaeedBRI

Guest
But didnt you wrong?
Shouldnt we write:
Code:
Ini_write_real
in creat event? Because if we dont write "currentroom" , its nothing I think. No?
 
Top