Use of Dictionary ?

0 favourites
  • 2 posts
  • So I been checking out stuff I havent tried yet in construct 2 and I tried using the dictionary. Im a bit confused at what kind of benefits are there to using a dictionary, instead of ex. global variables ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the main time I use a dictionary is in a container for an array. I load database records from a MySQL database into the array, the dictionary gets the field names and their position within the array. Then I can reference the field names using the dictionary - which makes the code much easier to read. And if I change the query that reads the data, the dictionary automatically adjusts itself so I don't have to make any changes to the code.

    Other uses for a Dictionary could be to hold a lot of stats for characters - each one gets its own copy. That way if you have a bunch of different types of characters, and each one have different stats, you don't have to have give the family all the possible variables - just a dictionary that can be customized for each type...

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