Unsure how to save

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Xethenion

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.

:bust_in_silhouette: Reply From: lewis glasgow
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
	#this data is encrypted in binary so only HxD can read it
	#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()
		print("no save file found!")

#the order you save is the order you load