I want to make a jigsaw puzzle in flash. I know how to create square kind of shapes. But I want to create this kind of irregular shapes. See the live demo of puzzles in the links shown
http://www.flashcomponents.net/component/jigsawpuzzle/preview/4952.html http://www.gamedesign.jp/flash/whitejigsaw/whitejigsaw.html
I just want to how to create the irregular shapes.
Does anyone know or can anybody give useful links as to开发者_StackOverflow社区 how this can be done.
My ideas:
- Shapes can be just Bitmaps, masked by irregular filled Shape. Each piece of puzzle has shared BitmapData. Shapes can be created by series of
drawRect/drawEllipse/curveTo
calls in fill mode. - Watch their relative positions to catch the moment when they should 'snap' together. Also cull combinations not close to each other.
If you're creating your shapes dynamically with code, try using the graphics.curveTo()
method. This can be used in combination with graphics.lineTo()
to make the outline for your pieces.
You could also make your pieces using the pen tool within the Flash IDE to create movie clips that can my used for creating object instances to be used as masks for your puzzle. This works if you plan on having the same puzzle layouts more than once.
That's done using masking: http://www.flash-here.com/tutorials/flash_masking.html
Have a look to the following:
http://www.sephiroth.it/file_detail.php?id=111#
A little bit old.
精彩评论