You have one Array (I'll call this ItemsArr) that contains all of your items and one Array (I'll call this Array InventoryArr for this post) for your inventory.
When you want to add a new item to your inventory you push the item Id from the ItemsArr to the IventoryArr, like:
IventoryArr: Push to front: ItemsArr.IndexOf("potion")[/code:4b9qp1hs]
Then you loop through your InventoryArr again to display the new object in the inventory.
So for example, let's say your ItemsArr looks like:
["potion","sword","armor","cape"]
Idx: 0________1_______2_______3
and your inventory array has a sword and armor and looks like this:
[1,2]
When you use [code:4b9qp1hs]IventoryArr: Push to front: ItemsArr.IndexOf("potion")[/code:4b9qp1hs]
Then your InventoryArr would look like:
[0,1,2]
If you then use [code:4b9qp1hs]IventoryArr: Push to front: ItemsArr.IndexOf("cape")[/code:4b9qp1hs]
Your InventoryArr would look like:
[3,0,1,2]
Then to display items, you loop through your InventoryArr and pull items from your ItemsArr using the item IDs stored in your inventory array.
The 5x5 is only a display change, not a fundamental data structure property. So you would address the 5x5 property in your display loop using a row variable and incrementing it every 5.
Like this: https://drive.google.com/open?id=0B-xiq ... jB6ZmtoaVk
wow! you're really helping me out! i did the same thing as your events:
prnt.sc/dh2ig5
it's almost working as i wanted, however, i have no idea why when i open the inventory (the player has to press "I" for it to appear) there's already an item in the first slot!
prnt.sc/dh2ils
and it's even more bizarre that when i debug the game, i can see that not only this already created item but also all the other itens that i create are being created and deleted so fast that you can't even see it being destroyed and created again, how would i possibly fix those issues?