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.
checking for matches
Finally we’re ready the add the last bit of logic for the match three game. We need to handle the selection of the balls, and the swapping of balls, as well as a couple of new animations. Then we need to check for matches, cause the grid to collapse and check for matches again until none are found.
In this step I’ll code the logic that causes the columns to collapse, for when matches are found. And once again I start by updating the Ball class.
I used GoKitLite for the tweening, and I’ll use that for all the main animations: the collapse, the swap, and the reset. The last two animations will be done in the next step of this tutorial, hopefully the last.
generating a matchless grid
In the second part of this tutorial I’ll add the logic to create a grid that contains no initial matches, meaning we don’t see three balls of the same color lined up vertically or horizontally. And yo start with, we’ll need to add the multiple ball types.