Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MustacheLincoln |
I’m working on my first save system and it consists of multiple dictionaries. Simply the players character, the enemy, and a dictionary for the icon of each item they have equipped, so anywhere between 2 and 10 depending. However I can’t figure out how to parse past the first dictionary. They’re all saved on the same JSON file, which looks like this with three dictionaries:
{"AttackPower":10,"Boss":"res://Bosses/SkeletalArcher.tscn","Character":"res://Characters/PitFighter.tscn","DodgeChance":10,"Energy":100,"HP":110,"Potions":4,"SleepChance":5,"Speed":2,"_AttackPower":10,"_BossHP":80,"_DodgeChance":10,"_Energy":100,"_HP":89,"_Speed":2,"fv":151.5}
{"UpgradeIcon":"res://Upgrades/SandmansBlackjackIcon.tscn"}
{"AttackPower":7,"DodgeChance":20,"HP":100,"Speed":1.4,"_DodgeChance":20,"_HP":80}
and the code for parsing it looks like this:
save_game.open("res://saverun.save", File.READ)
while not save_game.eof_reached():
var current_line = parse_json(save_game.get_as_text())
It works great for everything in the first dictionary, but the UpgradeIcon key and all the keys from the boss are completely ignored. I’m sure I’m just making a beginners mistake but I couldn’t seem to find a solution in the documentation.