I am creating a mining game where you use touch controls to tap blocks to destroy them. At the moment I am using a simple function which identifies the block that was tapped by UID and feeds it to a function that destroys the block.
These blocks are all in a grid next to each other and none of them overlap. They are all the same sprite but different animation frames (which gives them a different appearence).
I want to make the function destroy blocks ONLY if there is not completely surrounded by other blocks, i.e.
If you imagine that the numbers are all blocks of the same sprite. If the user tapped the '2' block it would NOT be destroyed because the game, ideally, chcked and found that it was surrounded.