Inventory Diablo 2

How to create an inventory like in Diablo 2?

For example, I take an object, it has a height of 4 cubes, and a width of 1 cube.
I drag it to the inventory and it gets exactly in the position of the cubes on which you dragged them.


I haven’t done that, but let’s imagine how to proceed.
So, first, bound some position squares to your item, and when you drag your item and the squares with it, use a grid feature to position the item properly, and check if the item’s squares are in collision with the inventory empty squares. If they are, they get an OK status.
If they aren’t, they get a NOK status and a red color.
If all the squares are OK, and the click is released, item is placed.
Something along those lines, I guess.
Give it a try and let us know.

2 Likes