Hello, I've got a problem I can't quite figure out with my inventory system. I looked in the FAQ sticky and didn't find an answer to my issue. Basically, I'm using an array to store 2 values: The slot it is in, and its item ID. I'd like to be able to swap that second value with another elsewhere in the array when the player clicks on the item in their inventory and drags it to another spot. It's kind of hard to describe what I want to happen in words so here are some doodles:
Here's a representation of the array. The first row is the item slot, the second row is the item's ID. Each column together makes one inventory slot.
The player clicks and drags an item from one slot to another in the game (represented by picking it up from the slot and attaching it to the mouse) and lets go.
As a result, the two values swap places on the array. In the game this is represented by the two items swapping slots.
The problem is that I don't know how to do that in the code. I would greatly appreciate the help because this has proven to be a real headscratcher for me.