making a jigsaw puzzle
in
Programming Questions
•
2 years ago
Hello,
I am a newbie and trying to make a thing that includes something like a jigsaw puzzle, with the original image carved up into pieces, and the user can drag the pieces onto the puzzle mat.
Right now I have it sort of working using rectangular pieces, and an underlying colored image of the puzzle mat, so pieces fit based on whether they're assigned color matches the color on the underlying image.
But I really want the pieces to be more irregularly shaped, and even with the rectangles I am having a bit of trouble detecting edges and snapping in pieces when the user gets "close enough" to the right section of the puzzle.
I have looked into SVG shapes and also the Blob library a bit, but, well, I don't really get how to use them. It seems like I can create an SVG outline of the puzzle mat with tracing where the pieces belong in Gimp, but I'm not sure how to get at individual pieces within that tracing.
The Blob library sounds like it should be a good thing to use, but I confess that I am lost about how to approach it.
I was wondering if anyone knows of any examples or has some suggestions that could point me in the right direction?
Thanks.
I am a newbie and trying to make a thing that includes something like a jigsaw puzzle, with the original image carved up into pieces, and the user can drag the pieces onto the puzzle mat.
Right now I have it sort of working using rectangular pieces, and an underlying colored image of the puzzle mat, so pieces fit based on whether they're assigned color matches the color on the underlying image.
But I really want the pieces to be more irregularly shaped, and even with the rectangles I am having a bit of trouble detecting edges and snapping in pieces when the user gets "close enough" to the right section of the puzzle.
I have looked into SVG shapes and also the Blob library a bit, but, well, I don't really get how to use them. It seems like I can create an SVG outline of the puzzle mat with tracing where the pieces belong in Gimp, but I'm not sure how to get at individual pieces within that tracing.
The Blob library sounds like it should be a good thing to use, but I confess that I am lost about how to approach it.
I was wondering if anyone knows of any examples or has some suggestions that could point me in the right direction?
Thanks.
2