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

Re: [pygame] Re: manually cutting a picture



Do you want to cut them into curvy non-recangular pieces or are rectangular pieces good enough? I'm not sure how to do non-rectangular pieces although it's an interesting puzzle :) I think you'd need to use the surfarray module.

--Mike

Marcus von Appen wrote:
On, Tue Nov 06, 2007, Joseph king wrote:

I have a kinda hard question.... i am trying to build a jigsaw game with
python, i would like to give the option for people to create there own
puzzle piece.... does anyone know how to accomplish this it is becoming
increasingly difficult for me

Create a surface with the full image, then cut it into single pieces using
the Surface.blit() method with the area argument:

fullimage = pygame.image.load ("image.png")
piece1 = pygame.Surface ((50, 50))
piece1.blit (fullimage, (0, 0), (20, 20, 50, 50))

You now have blitted the fullimage area located at 20, 20 (from the
topleft) with a width and height of 50 to piece1.

Regards
Marcus