Hello,
I am creating a survival game with an inventory system. The inventory system consists of three objects, the inventory slot, the resources, and an array to keep track of everything. The resources, a single frames with multiple frames that correspond with the Item ID, can be moved around through the drag and drop behavior when the Inventory is active. When the item is over a slot, it will snap to the spot so that you can organize your inventory how you like. This system is created by using instance variables. Each slot has its own slot number that makes it unique. The items have a the same instance variable that changes based on what slot it is in. When I drag one of the items away from the slots, it does not snap back to its original slot, the slot that shares the same slot number instance variable. Here is a screen shot of the code
When the items (AlmightyStuff) is dropped, the game will check to see if it is overlapping any inventory Slots (InvSlot). If it is not, the game then compares the inventory Slots' instance variable Slot Number to that of the items's. If they are equal, then the items should set its position to that inventory slot.
In theory, this should work, but it doesn't. Does anyone know how to fix this?