Need help with Minesweeper logic (to submit as a GDevelop example game)

I have a working example of Minesweeper that is 90% complete, but I need help with one function.

Expected behavior:

  1. User clicks on a tile with no neighboring mines
  2. All neighboring tiles without mines are revealed automatically
  3. This continues until the entire area without mines is revealed

This is usually done with a recursive function similar to this:


  • Reveal current tile
  • If current tile has 0 neighboring mines:
    • ForEach(NeighborTile)
      • If NeighborTile is NOT revealed
        • RevealEmptyTiles(NeighborTile)

I cannot figure out how to do this, so I’m asking for help on this forum. Can you help finish this project?


Playable game:

Download game:

Maybe you can do
Pick tiles under the ____ distance
If tiles has 0 mines
ANimation change to “revealed”

@Davy had made an example for the link object tools extension. Which might be similar to this. You can find it in the trello board. It might be helpful. There is also some documentation created for it, which can be found on the wiki


Yes, it seems similar to the Bust-a-Move example, when the bubbles of the same color fall.

Instead of the 1st condition on the color, it will be a condition on the number of neighbor mines that must be 0. This will pick every cohesive 0 squares.
It should be possible to reveal also their neighbors using a 2nd search from the square that are 0 and reveal to 1 distance.

There is an introduction of the concept on this page:

I just wanted to follow up and share that Alaska came up with a way to do this iteratively with adding a diamond shaped tester sprite and checking for collisions.

Thanks everyone!

1 Like