Hi.
I don't know exactly what the game's requirements are, since the inventory is designed around the player's needs in the game.
I like to use an array as the main data source for the inventory. that way, it’s easy to change the graphics or decide where to display it.
I’ve implemented drag-and-drop and added comments. I removed some things to make the example easier to understand.
After all, it’s also important to remember that the player might not land on an empty slot when dragging.
fex.net/s/tmrs9xc