I had been trying to rotate an image around its center in using pygame.transform.rotate() but it\'s not working. Specifically the part that hangs is rot_i
You are deleting the rect that rotate creates. You need to preserve rect, since it changes size when rotated.
def rot_center(image, angle):
"""rotate a Surface, maintaining position."""
loc = image.get_rect().center #rot_image is not defined
rot_sprite = pygame.transform.rotate(image, angle)
rot_sprite.get_rect().center = loc
return rot_sprite
# or return tuple: (Surface, Rect)
# return rot_sprite, rot_sprite.get_rect()