How Do I Call Values From a Dictionary [Solved]

0 favourites
  • 4 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • Hello!

    I am trying to call values from a dictionary to keep my player variables from level to level. However, they seem to be getting lost along the way. I debugged it and found out that it is saving values to the dictionary fine, but it will not retrieve them.

    Here is my code:

    Thanks for your support!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Object UIDs will be different when you switch to another layout. That's why you can't read the keys back.

    If you only need to save values for one player, don't add UID to the dictionary key names.

    If you need to save a set of keys for multiple characters, use some other identifier which you can control, for example an instance variable "ID".

  • Perhaps you could use the persist behavior on them to make them remember? Otherwise you could maybe give them an instance variable called id. Then, when the layout starts, create the needed number of sprites, set their id incrementally (so the first one is 1, next one 2 etc.) and then save your information based on that id?

  • Ah yes the instance var id did it. The UID had to be one of the only things I didn't check.

    Thank you both!

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