The optimal way is probably to use copyPixels() for each puzzle piece,
setting the alphaBitmapData argument to an image that contains just
the puzzle piece shape. That will effectively mask out the shape of
the piece, but will perform a lot better than using a vector mask, as
it will have modified the image, rather than apply the mask each time
the screen area gets redrawn.

Jigsaw puzzle pieces are likely quite small as vector graphics, so you
might want to keep them as vector assets and then create the
alphaBitmapData objects at runtime, as you need them.

If you really want to generate the shape pieces dynamically, you could
divide the image into rectangles (or randomly varying quadrilaterals,
to keep it interesting), then have a selection of nobbly bits you
could randomly choose to add or remove from each side of the pieces.
Having someone draw these by hand seems like less hassle though -
unless you need to create a lot of puzzles...

Peter


On 7/6/06, Guntur N. Sarwohadi <[EMAIL PROTECTED]> wrote:
I'm working on a puzzle game in flash, much similar to jigsaw puzzles you
see in gameHouse or such casual game publisher. I'm having a hard time
trying to cut an image to make it as puzzle pieces in AS2. Currently I'm
doing it the hard way, cloning bitmapData image, and masking portions of the
image. Can you cut parts on an image using bitmapData methods? And does
anyone know how to create the infamous jigsaw pattern to it as well?

Many thanks,
Guntur N. Sarwohadi
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to