N
Nexusrex
Guest
Hello, i've been trying to make a little save and load system in my game.
I've been using this code:
Right now, after i finish the game and close it then reload it. It looks like nothing happened. Would someone tell me the reason of this?
Thanks in advance.
I've been using this code:
Code:
//Loading script
if file_exists("save.ini")
{
ini_open("save.ini");
//Insert variables here vvv
global.beatedonce = ini_read_real("save","beatonce",0); //Beated game once
global.tokens = ini_read_real("save","tokens",0); //Token number
global.gameplaydone = ini_read_real("save","gameplaydone",0); //Beat whole game
//Insert variables here ^^^
ini_close();
}
Code:
//Saving Code
ini_open("save.ini");
//Insert variables here vvv
ini_write_real("save","beatonce",global.beatedonce);
ini_write_real("save","tokens",global.tokens);
ini_write_real("save","gameplaydone",global.gameplaydone);
//Insert variables here ^^^
ini_close();
Code:
//Game start event in obj_controller
scr_load(); //Load the save file
global.souls = 3; //player's lives
global.scanline = true; //scanline effect
global.sfxemit = audio_emitter_create(); //SFX emitter
global.musemit = audio_emitter_create(); //Music emitter
global.checkpoint = 0; //Checkpoints
//Checkpoints chart, 0 = nothing, 1 = lava, 2 = aqua, 3 = thunder, 4 = wood, 5 = lab
global.beatedonce = false; //Checks if beated or not to show the extras menu
global.tokens = 0; //Tokens to enter the extras
global.gameplaydone = false; //If the whole game is beated.
Thanks in advance.
Last edited: