Bubble Shooter Game in Unity: Part 11

endless moving the grid

So what if we wanted to pick the code from the last tutorial in this series and make the grid scroll endlessly down the screen? I’d need to add new rows of balls, and in order to do that I’d have to flip the grid upside down (mainly because since the beginning of this series I’ve been using a grid that starts at the bottom of the screen.)

Bubble Shooter Game in Unity: Part 10

moving the grid

In order to move the grid down the screen we only need to make a few adjustments to the code. Before we had a variable controlling the number of visible rows at the beginning of the game; but with a scrolling grid you don’t need that. The grid should be entirely visible now, with a fixed gap of empty rows at the bottom of the grid which will add an initial distance between visible cells and the shooters (as well as the necessary empty rows which will need to add the player’s bullets which do not create an immediate match.)

Bubble Shooter Game in Unity: Part 9

multiple shooters

So what if you want to use multiple shooters? The class I wrote for the ray cast shooter can be easily updated so we can use as many shooters as we want in the game.
I’ll place five shooters at the bottom of the screen, and for the sake of this tutorial, each shooter will now have a fixed color type, so the color won’t change after a shot.
(Although you could easily keep the existing logic that handles that in the touch up handler, who knows, it might make things interesting to have each shooter select its color randomly and keep changing its color randomly after every shot.)

Sketch: Mr. Fantastic

in affinity designer

Bubble Shooter Game in Unity: Part 8

using a hex grid

As I mentioned before, a bubble shooter game looks better with a hex grid, specially when the targets are circles. A square grid populated with circles should not run matches diagonally, because it looks weird. So with a square grid you can have a maximum of four neighbors for each cell (diagonal neighbors look too far away when using circles). But with a hex grid you can have up to six neighbors.

Bubble Shooter Game in Unity: Part 7

removing disconnect balls

We need to remove all balls (bubbles) which are no longer connected to the main body of the grid.

I do this with a new method in the Grid class, called right after I remove matches from the grid.

Sketch: Ugly Vest

in affinity designer

Bubble Shooter Game in Unity: Part 6

finding matches

Finding matches in this grid is very similar to the logic I used in the match three game, particularly the “Tap to Match” variation.

Bubble Shooter Game in Unity: Part 5

collisions

After shooting a new bubble collision is handled through Box2D and the 2D circle colliders in each of the bubbles and the bullet.

Sketch: The Key

in affinity designer

Left Brain Posts:

Bubble Shooter Game in Unity: Part 11

endless moving the grid

Bubble Shooter Game in Unity: Part 10

moving the grid

Bubble Shooter Game in Unity: Part 9

multiple shooters

Bubble Shooter Game in Unity: Part 8

using a hex grid

Bubble Shooter Game in Unity: Part 7

removing disconnect balls

Bubble Shooter Game in Unity: Part 6

finding matches

Right Brain Posts:

Sketch: Mr. Fantastic

in affinity designer

Sketch: Ugly Vest

in affinity designer

Sketch: The Key

in affinity designer

Sketch: Aquaman

in affinity designer

A Typical Romulan Morning

in illustrator

Drawing in Affinity Designer

four sketches