[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] puzzle piece problem.



On Wed, November 7, 2007 3:31 pm, Joseph king wrote:
> hey it is me again on the same issue..... thanks for the help but now i am
> on to something a little easier if you program a lot. My issue now if you
> saw the code that i had which i will repost on this...... creating a
> "cookie cutter" to cut out the puzzle piece
> shape of where the user wants and size/shape the user wants...... but i
> seem to be having an issue with this line of code

Are you proposing to have the user decide not just the position of a
puzzle-piece shape, but the exact shape of the knobs/grooves on the edges?
Rather than coming up with a set of functions for computing possible
shapes, why not draw them in advance?

Say, draw a puzzle piece (try Inkscape), load it, then use that as a
"mask" to copy part of an image. Or draw several versions of the
knobs/grooves that can be combined with a basic rectangle.

<http://kschnee.xepher.net/code/shrubbery.py> has some code that might be
relevant for copying part of one image to another using a pixel-by-pixel
check of a third, "mask" image. A better way to do it might be to use
transparency somehow.