My code:-
def rotate(self):
self.rotate_ticks -= 1
if self.rotate_ticks == 0:
self.angle = (self.angle + self.angular_velocity) % 360
orig_rect = self.image.get_rect()
rot_image = pygame.transform.rotate(self.image, self.angle)
rot_rect = orig_rect.copy()
rot_rect.center = rot_image.get_rect().center
rot_image = rot_image.subsurface(rot_rect).copy()
self.image = rot_image
self.rotate_ticks = 3
I have written the above code for rotating asteroids in my game Space Shooter which I have made using Python's pygame.
Please help me in fixing this error, I have tried many times to do changes to the code and even I changed the dimensions of my assets, still getting this error. And when I run this game, it crashes after few seconds.