Jigsaw Puzzle Game
~Jigsaw Puzzle I~
And now for something completely different, my first puzzle game! I have been playing those CSI games for months (now playing «CSI: Dark Motives»), and some of them have this kind of puzzle where an important document is found in a trash bin but was ripped to pieces. You have to put the paper back into one piece to be able to read the message.
In this game it’s a picture instead, but the fun is the same. I wrote the AS3 code to be as smart as the ones from the CSI games. The pieces will snap into place and play a sound when you place them in the right position. Control-clicking will rotate a puzzle piece. The game keeps record of your progress and knows when you completed the game.
I saw code examples of how to create puzzle games like this in the «Beginning Game Programming with Flash» book by Dr. Lakshmi Prayaga, but frankly, his 300 lines of code use purely brute force and terribly lacks on code structure and reusability. My program has less than 50 lines and is 100% reusable, so that I can create different jigsaw games without having to change a single line of code.
In the end my program is 83% smaller than Dr.Prayaga’s version from his book, not to mention, smarter, faster, reusable, and uses less memory. I know most of you don’t care and won’t even read this far, but what I am trying to show here is that programming *is* an art on its own right – but only when you do it properly, using scientific methodology.
Hope you like it and thanks for coming by!
Categories and tags of the game : Adult, Animal Hybrid, Feline, Futurama, Jigsaw, Pre-rendered 3D