0

I have been trying to rotate sprites in pygame for quite a while. I came across this to help me rotate it around the center:

http://www.pygame.org/wiki/RotateCenter

But I don't really understand what the rot_image = rot_image.subsurface(rot_rect).copy() line does. There are a lot of pages about this kind of thing but they haven't helped me. I tried it without that line and it spins oddly. Could anyone tell me how that line prevents that?

4

1 回答 1

0

pygame.transform.rotate

除非旋转 90 度增量,否则图像将被填充更大以保持新大小。

因此,引用的行 wich*only* works with square images使用原始中心保持原始尺寸。请记住,使用这种方法可以“修剪”旋转的图像(即:松散一些区域)以保持其大小。

于 2013-01-26T15:23:33.923 回答