I am trying to make a save feature in a game so that a player could save, then quit the game, then open the window again to select proflie and play from when they left off. Thanks!!
Jacklittle01 -3 Light Poster
Recommended Answers
Jump to Post— TrustyTony 888Fine, all the best with your studies of json and ConfigParser modules!
Jump to Post— Gribouillis 1,391Here is an example. The program creates a dictionary containing the current state of the game, using simple data types, then saves this snapshot on disk in a json file:
import json if __name__ == "__main__": state = { "player_name" : "bob", "level" : 3, "elapsed_time" : …
Jump to Post— james.lu.75491856 0Try making a
main()function inside aGameobject, setting every variable toself, and using pickle to save/load it.(and Creating and instance of Game if not loadable)
Jump to Post— TrustyTony 888Variables are just values in locals() dictionary.
All 13 Replies
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Jacklittle01 -3 Light Poster
Gribouillis 1,391 Programming Explorer Team Colleague
james.lu.75491856 0 Junior Poster
Jacklittle01 -3 Light Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Gribouillis 1,391 Programming Explorer Team Colleague
Jacklittle01 -3 Light Poster
Gribouillis 1,391 Programming Explorer Team Colleague
Jacklittle01 -3 Light Poster
Gribouillis 1,391 Programming Explorer Team Colleague
Jacklittle01 -3 Light Poster
james.lu.75491856 0 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.