0 votes

The game in question is a 2d top-down rpg styled game based off of Heartbeast's tutorial from YouTube from this link.

The question I have is how to make a saving system that allows me to save the location of preset coordinates from a certain scene to be used in the continue screen containing save slots. The way I am wanting to trigger this saving process is through an area2d with collision2d resembling a circle of light in certain scenes that when used trigger a separate pause menu that displays the save slots to be edited through presses of the buttons to edit the location stored in them and change their name from empty to the name of the scene its saved for.

This game doesn't involve story progress or player items as the design is a simple dungeon crawler. This saving system is to help keep progress of the current floor the player has traveled through these predetermined spots.

I am still fairly new to scripting, so any code provided would be greatly appreciated. I am familiar to making a basic pause menu.

Godot version 3.2.2
in Engine by (19 points)

1 Answer

0 votes
data = {"health" : 100, "mana" : 10, "coins" : poor, "scene" : scene_path}

func save_file():
    var savefile = File.new()
    savefile.open(save_path, File.WRITE)
    #this creates the file if none is found
    savefile.store_var(data)
    #this data is encrypted in binary so only HxD can read it
    savefile.close()
    #verry importent!

func load_file():
    var savefile = File.new()
    if savefile.file_exists(save_path):
        savefile.open(save_path, File.READ)
        data = savefile.get_var()
        savefile.close()
        get_tree().change_scene(data["scene"]
    else:
        print("no save file found!")

#the order you save is the order you load
by (256 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.