Do I need separate arrays for each chest? (Inventory)

0 favourites
  • 4 posts
From the Asset Store
_ Fully animated top down mimic chests game sprites _
  • Hi guys, I need a help with my inventory system

    Look at the below image as an example

    My inventory system is like this and I use arrays in my project and the code is just like the inventory example in construct 3 start page

    In my game there are many chests with items which I want the player loot them

    my question is:

    should I use separate arrays for each chest in order to store the item IDs and other data (is this efficient way or not?) or that's better to use another method?

    THX

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not familiar with the example but if you are only using 2D arrays you could use 3D arrays instead and use a different depth for each chest.

  • Don't worry about efficiency, just use whatever makes sense to you.

    You can use a container to associate each instance of the chest sprite with it's own array.

    Or you can use a 3d array as calminthenight suggests, which is basically a stack of arrays all in one object. However, this is a little less flexible in that all of them will have to have the same dimensions.

  • So, I'm going to try 3D arrays.

    Thank you guys for the suggestion!

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