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

Re: [pygame] puzzle piece problem.



Joseph king wrote:
the problem i
see now is getting it to cut the picture just so that there would not
be any left over shards from where they did not cut the image
properly.

To prevent that, instead of specifying the shape of each piece
separately, you need to arrange it so they specify lines along
which to cut the picture. The shapes are then whatever is left
after cutting along those lines, and they must fit together.

For a user interface, you could give them a set of predefined
edge-shapes to link together, or you could provide some kind
of interface for drawing an arbitrary curve (harder).

To create the mask for a piece, you take geometrical descriptions
of the shapes of its edges and use pygame.draw functions to
fill its interior in white on a black background in an
offscreen surface.

--
Greg