I'm working on a drag-and-drop puzzle block game. The player toggles through the pieces available, then drag-and-drops the piece they want onto a grid.
Now what happens is, if the player drops a piece in the wrong spot, IE out of the grid, over a differently colored piece, or on the boundary walls, it destroys the piece and creates a new one at the starting point. The same happens if the player correctly drops a piece into the grid, it creates a new piece for the player to drag around at the starting point.
The problem I am having is that it won't delete pieces that are the same as itself!
The player has small arrows to toggle between different shapes for, say , Red Piece. None of the red pieces will be destroyed if they are dropped on top of other red pieces. Everything else works great, but the red pieces won't destroy when dropped on other red pieces.