game_save_buffer

Saves a game state to a given buffer.

Syntax:

GML Code Example

game_save_buffer(buffer);


Argument Description
buffer The buffer id to save to.


Returns: N/A


Description

With this function you can save the current state of the game to a previously created "grow" buffer (see Buffers) which can then be loaded again at any time using game_load_buffer function. This function is designed for use in a single room at a time (ie: it's not advised to do a buffer save in one room, then try and load the buffer from another one) and should ideally be used only for checkpoints or level restarts.

NOTE: This function is very limited and it is designed for the beginner to get a checkpoint system up and running quickly, but more advanced users may prefer to code their own system using the File functions, due to the fact that the game will not save any of the dynamic resources like data structures, surfaces, added backgrounds and sprites etc..


Example:

GML Code Example

if keyboard_check_pressed(ord("S"))
    {
    global.Checkpoint = true;
    game_save_buffer(save_buff);
    }
 

The above code will set a global variable to true and then save the current game state to the buffer indexed in the variable "save_buff" when the key "S" is pressed.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here