#Need Help with my game

13 messages · Page 1 of 1 (latest)

vagrant fog
#

so probably i will post stuff that i will need help here n stuff , so yeah! if anyone can help me , heres the place.

#

right now i need help with my save and loading stuffs cause i dont know how to exactly do it

#

when i press the continue button , it spawns me at the very first level and not where i remained like lvl 2

#

global.game_data = 
{
    room_data: {},
};

function save_game() {
    
    save_room();
    
    // Convert the data to a json string
    var _string = json_stringify(global.game_data);
    
    // Create a buffer
    var _buffer = buffer_create(string_byte_length(_string) + 1, buffer_fixed, 1);
    
    // Write game data into the buffer
    buffer_write(_buffer, buffer_string, _string);
    
    // Save the buffer as a file
    buffer_save(_buffer, "save.dat");
    
    // Delete the buffer
    buffer_delete(_buffer);
};

function save_room() {
    
    // Save Values
    var _array = [];
    
    // What to save in Object 1
    with(oHellio) {
    var _struct = 
    {
        object : object_get_name(object_index), // ← Get the name of the object we're saving.
        // ↓↓↓ Other Data
        x : x,
        y : y,
        hp : hp,
        // ↑↑↑
    }
    // Push the struct to the array.
    array_push(_array, _struct);
    }
    
    // Save All the data
    struct_set(global.game_data.room_data, room_get_name(room), _array)
}

function load_game() {
    
    if (file_exists("save.dat"))
    {
        // Load the buffer
        var _buffer = buffer_load("save.dat");
        
        // Read the data from the buffer into a json string
        var _json = buffer_read(_buffer, buffer_string);
        
        // Delete the buffer
        buffer_delete(_buffer);
        
        global.game_data = json_parse(_json);
        //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑\\
        
        // Load
        load_room();
    }
}``` this is the code for well saving and laoding and judacraz said to extract my gamedata somehow , if anyone can help me that would be amazing
#

#help_0 message heres the message ns tuff

#

this error seems to appear when trying to laod the game with L key

#

idk how to fix it

vagrant fog
#

Please someone help

vagrant fog
#

Can someone help me please?

vagrant fog
#

Damn

weak moon
#

idk but I like the arrows pointing to things in your comments

vagrant fog
dapper barn