Skip to content
Sign upLog in

How to implement a save/load system to a game?

Profile icon
mkhoi

I am making a game and want to have a save/load system because it is frustrating without the save/load system (its a long game and also it has permadeath but if i have the save/load system it won't have permadeath)

Check it out:
The Wacky Warrior, its on Challenge

Someone please help me!!!

You are viewing a single comment. View All
Profile icon
ash15khng

You could let the users download a file, with their progress in it (to save), and add a load function (to load the text in the file).

Profile icon
mkhoi

@ash15khng
What is the specific instructions for that?

Profile icon
ash15khng

@mkhoi
You could create a JSON object or whatever you want, then write it into a file like this:

save = <whatever you need however you want to save it> with open("file.txt", "w") as f: f.write(save)
Profile icon
mkhoi

@ash15khng
I'll try it out

Profile icon
mkhoi

@ash15khng
What about the load function?

Profile icon
ash15khng

@mkhoi
You get it as an input, then save it to your variable(s).

Profile icon
mkhoi

@ash15khng
I dont understand that. How do you do that?

Profile icon
ash15khng

@mkhoi

load = input("Save string: ") load = <however you're saving your game data>
Profile icon
mkhoi

@ash15khng
ok...

Profile icon
kwambugu17

@ash15khng
what does the f do i dont really get it

Profile icon
ash15khng

@kwambugu17
f is just a name for the file object that we are using so later we can call it using f.