Right now i am making inventory system for my game and i have some issues with it.
I would like to get location (X,Y) of the item, based on it's value.
My inventory array looks like this:
Frame Number
Amount
Name
With frame number i am selecting picture to be shown in inventory, if amount is higher than 0. But with "Name" parameter i would like to find specific item in inventory and to increase/decrease it's amount.
Let's say that i want to reload my gun. In game i have "Handgun" and "9mm ammo clip" items in my inventory. When player reload it's gun, one 9 mm ammo clip is removed from inventory. My problem here is how to refference this specific item in array. Right now i am adding items from inventory with function that has two parameters, number of frame to be shown and amount. When i am removing i must specify X location in array and amount to be removed.