Like Nathaniel Krueper




Published: February 3, 2019 0 0 174
By: Nathaniel Krueper, Cal Poly Pomona
Category: Game Development
Hashtags: #GameDevelopment #GUI #JAVA

My own take at a match-3 game. You can click on a block to select it and move it around with the arrow keys. The block will keep sliding in that direction until it hits a wall or another block. It three blocks of the same color (except black and white) are touching each other, they will all change to random colors and any blocks with numbers on them will have their numbers decreased by one, disappearing when the number reaches zero. Get rid of all the numbers to move on to the next level. As you progress, the playing field will get larger, numbers on blocks will get higher, and more colors of blocks will appear.

Levels are generated randomly, with size and complexity scaling to the number you input. You can choose to complete one level or complete each level starting from level 1 and play infinitely. There is also a puzzle mode and a level editor to make custom levels to play.

One problem I encountered while making this game was that since black blocks could not be moved and are placed randomly, it was possible that a numbered block might be generated surrounded by black blocks on all sides, making the level impossible to complete. To fix this, I implemented an algorithm to make sure there was a path from each block to every other block. The algorithm starts at a random point on the grid and checks it. If that point is not occupied by a black block, it recursively checks the surrounding tiles. Once the grid is finished, any black blocks surrounding unchecked tiles are deleted.