-

Puzzle Game Demo

Writing the basic functionality of a match three puzzle game turns out to be a lot of fun, especially when it comes to detecting different matched shapes on the board.
To be able to easily define which shapes are valid, it's useful to have a general algorithm which can compare chains of adjacent pieces to custom texture 'bitmaps'.

First we turn each shape into a list of positions relative to the position of a randomly picked starting square.

To account for all orientations we can transform each shape by (x, y), (-x, -y), (y, -x), (-y, x).

Now it's just a matter of finding all the chains of adjacent pieces and checking them against each orientation of the shape maps, starting with those that will give the player the most points.

And here's the resulting demo, with some simple gameplay mechanics:

Fullscreen
Get the android apk.