Hi Joannes!
I'm glad you liked this game!
I have checked the (slightly smaller) version of this app I put on github.com/jgmy/jigsawpuzzle_phonegap and it is a bit smaller.
In case you don't feel comfortable using GIT (and don't want to download the big 12Mb full source with many redundant files), download this:
apagada.com/varios/JigsawPuzzlePhone
I also have some older versions in my web, just in case you only want to know how the puzzle is made.
The algorithm is simple:
-First I divide an image in pieces. Each piece has a central part (its size is the size of an average puzzle piece center part) and a margin (its size is the maximum size of the puzzle piece). Pieces "overlap" at the margins.
-I use the "canvas" plugin to mask the puzzle piece, so "holes" are created into it (and most margin area removed).
-I also put instance variables marking the logical X and Y of the piece.
-A unique group id is also given to each piece.
-I use "drag" instead of "click" or "touch" for all, so I don't need cheking whether mouse or touch are being used.
-When one piece is "drag", all pieces of the same group are pinned to it.
-When the piece is "drop", all pieces of the piece's group are checked against all desired neighbours (i.e. piece (4,7) looks for (3,7), (4,8)...). If the desired neighbour is where it should be (within a small range of 5 pixels), the piece is aligned and added to the group, so it seems to "snap".
Hope you understand the above text. I could try to make a video, but I don't have much time to do it.