[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] rotating problem
Michael wrote:
> I want to rotate a surface in-place clipping anything that would be
> outside the original rect and keeping the original colorkey and so forth.
> I think this will make a 'rolling stone' sprite work the way I want.
> Currently if I try to rotate the stone as it moves it gets the effect of
> bouncing which is not what I want. This happens even if I center. The
> original image is dead center and perfectly round so it isn't the image
> causing the bounce effect. Any suggestions are appreciated. Thanks.
one option would be to use the source clipping option in the blit function.
a simple function to do it all would be this..
def blit_rotated_clipped(dst, src, pos, angle):
"blit a rotated image clipped to original size"
rot = pygame.transform.rotate(src, angle)
srcrect = src.get_rect()
secrect.center = rot.get_rect().center
dst.blit(src, pos, srcrect)
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org