I have a system where you can pick up items, and their number representing them shows up in the first available empty cell in the inventory 2d array, which is 10 width and 5 height. I have a tilemap that represents the 2d array.
I'm doing the item going into the first empty (with the number 0) slot by finding the index number of the first 0. So then, I tried to make a system where the game finds out where the index number is on the array, in X and Y coordinates, and then put that number on the array. That's where I have a problem. I made 2 variables, "YIndex" and "XIndex", and the "Index" variables (I just made it to make the equations in YIndex and XIndex look less cluttered, I could as well have done ArrayName.IndexOf(0) without the variable "Index").
How do I make these variable do the right thing? Here's a capx, the weapons don't destroy on getting picked up on purpose.