Hey guys,
I'm working on a problem that is similar to the "inventory tetris" idea where you have an x by y grid upon which you have differently shaped inventory items. Like this: http://gangles.ca/images/screenshots/InventoryTetris_Title2.png
The problem I'm having is that, while the player is dragging an object, I'd like to highlight groups of grid cells that are the right size for the object to fit. So, if the player is dragging an L-shaped gun or something, all the L-shaped areas on the grid matching the object's orientation would light up so it is obvious where the object can be placed.
I'm having a lot of trouble figuring out what sort of algorithm I can use to achieve this. I imagine I might be able to use a depth-first search to find the different available areas. But I'm really unsure how I could detect if the area has the correct shape for whatever is being dragged.
I feel like this is the sort of problem that has been solved before, but I'm having trouble identifying existing algorithms that will be helpful. Does anyone have any leads on an algorithm or procedure that would help out with this?