This tutorial covers the core mechanics that make Bubble Shooter games engaging: removing connected bubbles and detecting floating islands.

Key Topics:

Connected Bubble Detection

When a bubble snaps to the grid, the game checks for matching connected bubbles:

  • Uses a depth-first search algorithm to find connected groups
  • Handles the hexagonal grid pattern with offset rows
  • Only removes groups of 3 or more matching bubbles
  • Bubbles are destroyed with a staggered delay for visual appeal

Floating Island Detection

After removing connected bubbles, the game identifies and removes "floating islands":

  1. Mark Connected: Starting from the top row, mark all bubbles connected to the ceiling
  2. Find Floating: Any unmarked bubbles are considered floating islands
  3. Remove: Destroy these isolated bubbles since they're no longer attached

Smart Color Management

  • Available bubble colors update based on what remains on screen
  • Prevents generating bubbles in colors that no longer exist
  • Ensures players can always make meaningful moves

Watch tutorial