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

Re: [pygame] Re: manually cutting a picture



what i want to do is make it so that the user playing the game can decide how the pices are cut size shape and other things like that. i can't seem to get it to where the user can use his mouse per say or have pre shaped cut out templates to chose from to make what he wants a puzzle piece.
thanks for all your help so far.
On 11/6/07, Michael George <mdgeorge@xxxxxxxxxxxxxx> wrote:
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
>