Finding matches in this grid is very similar to the logic I used in the match three game, particularly the “Tap to Match” variation.
After shooting a new bubble collision is handled through Box2D and the 2D circle colliders in each of the bubbles and the bullet.
creating the grid
In a bubble shooter game, just like in a match three game the level of difficulty comes from how easy it is to find good matches.
shooting the bullet
Now that I have the path on screen, shooting the bullet is quite easy. I can use the same path to move the bullet on the screen. So after the user selects a path and releases the touch on the screen, we activate a bullet gameObject, and animated it along that path.
drawing the dotted path
In the last step we collected the collision points, through a series of ray casts, and now we’re ready to use these points to draw a dotted line demonstrating the bullet’s path.
Here’s the RayCastShooter class with the updates:
This time, building on the previous series of tutorials on match three games, I’ll go over how to build a bubble shooter game. There are a number of ways to go about this, using a grid, or not using a grid, using physics or not using physics… I’ll show you one way of doing it, explaining the basics so you can extend to meet your game idea needs.
adding neighbors to matches
The one thing left to explain is what to do if you want to remove not only the group of matched balls but all balls of the same type which are connected to the original match group.
Sounds more complicated than it is. All you need is one extra check wherever in your logic you first create the matchList.
drag and drop
This is the most complicated of the types of Match Three games I’ve shown so far. The player can drag any ball either vertically or horizontally and when the ball is dropped the player can swap with any other ball in either the same row, or in the same column depending in which direction the player is dragging. There are no refreshes, the grid is finite, AND the grid must then collapse sideways.
This is yet another version of Match Three games, where the player must connect the balls when searching for matches, and can do so in 8 directions. So I’ll use the LineRenderer component, with nothing fancy, just to show how the logic for connecting the balls should work.
tap to match
Now that we have the main game logic in place for a typical match three game it’s time to break stuff. In this tutorial, I’ll show you how to change the existing logic to create a match three game where the player must only tap the balls to check for matches.