Common use of Dictionary, Array

0 favourites
  • 2 posts
From the Asset Store
Make your horror game even more Scary with sound effects! :)
  • hello, I was wondering if you could give me your experience when you have used Dictionary instead of an Array and vice versa.

    I have read the manual of both objects and right now I think:

    • a dictionary is like a 2d array, but with less options to manipulate the data
    • both objects can store numbers as well as strings.
    • I could store an inventory in both a Dictionary and 2d Array (if I'm right) and change the values (at any time).

    I am looking forward to your experience when one object was more useful than the other or some advice when not to use Dictionary or Array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Array saves as "location" and Dictionary as named keys.

    Most of the time I would use Array for inventory and tiled maps. It is easy to compare positions by slot ID and check if they are occupied or not.

    Dictionary is also very useful for all kind of things. For example you could use it as container for instance to have some extra variables if you need to make them at runtime.

    There is a lot that both can do. Just sometimes one or another could be more suitable for the task.

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