我正在尝试使图像在其中心旋转,但出现错误:
Traceback (most recent call last):
File "C:\Users\User\OneDrive\mario_kart.py", line 2320, in <module>
banana.rotate(30)
File "C:\Users\User\OneDrive\mario_kart.py", line 154, in rotate
self.picture = pygame.transform.rotate(self.picture, angle)
pygame.error: Width or height is too large
我用pygame.transform.rotate()函数尝试了一个非常基本的旋转,该函数需要一个角度参数并尝试旋转图片
class Obsticle:
def __init__(self, x, y, neow):
self.xpos = x
self.ypos = y
self.pictre = neow
[...]
def rotate(self, angle):
self.picture = pygame.transform.rotate(self.picture, angle)
banana = Obsticle(banana_x, banana_y, banana_pic)
while True:
[...]
banana.rotate(30)
我期望的是图像围绕中心旋转。但是相反,我的整个游戏都停滞了,并给出了我上面显示的错误