Sliding Puzzle Game
Oct 12, 2017
How the published game works: Click a piece next to the open/empty space and the piece will slide over to occupy that space. Only pieces adjacent to the empty space can move. Keep sliding pieces around to unscramble them into the proper picture.
How the mechanics work: Each piece has 4 motion paths and 1 variable to track its current position on the board. The empty space also has a "position" variable and there is one additional "control" variable. When you click a piece, a quick bit of math is performed to determine the distance between the piece and the empty space and the result is sent to the control variable. A piece will move along the appropriate motion path IF the control variable is equal to certain values (as explained in the video).
Simple enough? Enjoy!