So I'm building a game where the player can drag and drop ship components onto a grid to design their own ship, but I'm having trouble running a check to make sure that all the components are connected as a single ship.
Currently I've got a check to see if each ship component is overlapping with another ship component offset in each direction by the size of the grid, which works for finding stray cells of the grid which are filled, but doesn't for two groups which are not connected.
Anyone have any ideas as to how I can check if all the filled cells of the grid are joined as one?