How do I Use Dictionary to Save my Game?

0 favourites
  • 4 posts
From the Asset Store
You must shoot down the enemy planes and eliminate them to earn points.
  • Hi all.

    I have been working on a project for some time now and the moment to work on the saving system for it has come.

    I have been trying to wrap my head around the Dictionary and how to use it to save the player progress, but so far no good. I have read multiple articles and posts on Dictionary and nothing, so i was wondering if i could get a more direct answer here.

    The concept is simple.

    I have multiple characters and each has a level, the current experience and the experience needed to reach the next level.

    To make it more organized i would also like to be able to save the Dictionary that contains all the game info as a Jason file and then load it back up whenever the user enters the game.

    But i have no idea how to use the Dictionary as all that i have ever used was global variables...

    I did noticed the the Dictionary has instance variables, maybe i could use these to save all my info?

    I do know how to work with LocalStorage but like i said i would to able to save everything as a Jason file.

    Any tutorial or explain on how to get the Dictionary to work would be highly appreciated.

    Thanks in advance and sorry for all the trouble.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well I managed to get it working and im now able to save the value of the keys into a Jason File and Load it back up using LocalStorage.

    However im having a bit of an isssue.

    While using the Debugger i noticed that the update value of the keys don´t show when they are supposed to, but when i check the localstorage the updated values are there so i know its working, but why is that happening?

    When i restart the capx i can see theupdated values on both the LocalStorage and the Dictionary...kinda weird

    I was using text to display the values of the keys, so now they always stay at the previous value...would appreciate any help.

    The Screenshots of the code are on my dropbox if it is of any use: ... a5dwa?dl=0

  • Sorry for Bumping.

    Just really could use an answer.

  • If Anyone can help i would really really appreciate it. This is like the last thing i need to fix to get my saving system to work.


    Nevermind, i´m an idiot after trying just about everything i finally looked at my localstorage events and realized the only problem was my localstorage events were not correct. All i needed was to add the even "on X exists"- get item and now both my LocalStorage and dictionary update when i want to...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)