draw_utils.py
def pivot_rotation(surf, pivot_x, pivot_y, angle):
    """ rotate pygame surface surf along specified pivot
    """
    sprite_w, sprite_h = surf.get_size()
    centerx = 0
    centery = 0
    
    pivot_c_x = pivot_x - sprite_w // 2
    pivot_c_y = pivot_y - sprite_h // 2    

    new_center_x = centerx + pivot_c_x
    new_center_y = centery + pivot_c_y
    
    c_off_x, c_off_y = rotate(pivot_c_x, angle)
    
    new_center_x += c_off_x
    new_center_y += c_off_y
    
    muzzle = pygame.transform.rotate(surf, 180-angle)
    m_size = muzzle.get_size()
    new_x = new_center_x - m_size[0]//2 - pivot_c_x
    new_y = new_center_y - m_size[1]//2 - pivot_c_y

    return new_x, new_y, muzzle
 rotate pygame surface surf along specified pivot
    
rotate pygame surface surf along specified pivot
rotate pygame surface surf along specified pivot
def pivot_rotation(surf, pivot_x, pivot_y, angle):
    sprite_w, sprite_h = surf.get_size()
    centerx = 0
    centery = 0
    pivot_c_x = pivot_x - sprite_w // 2
    pivot_c_y = pivot_y - sprite_h // 2    
    new_center_x = centerx + pivot_c_x
    new_center_y = centery + pivot_c_y
    c_off_x, c_off_y = rotate(pivot_c_x, angle)
    new_center_x += c_off_x
    new_center_y += c_off_y
    muzzle = pygame.transform.rotate(surf, 180-angle)
    m_size = muzzle.get_size()
    new_x = new_center_x - m_size[0]//2 - pivot_c_x
    new_y = new_center_y - m_size[1]//2 - pivot_c_y
    return new_x, new_y, muzzle
def pivot_rotation ( surf , pivot_x , pivot_y , angle ) : sprite_w , sprite_h = surf . get_size ( ) centerx = 0 centery = 0 pivot_c_x = pivot_x - sprite_w // 2 pivot_c_y = pivot_y - sprite_h // 2 new_center_x = centerx + pivot_c_x new_center_y = centery + pivot_c_y c_off_x , c_off_y = rotate ( pivot_c_x , angle ) new_center_x += c_off_x new_center_y += c_off_y muzzle = pygame . transform . rotate ( surf , 180 - angle ) m_size = muzzle . get_size ( ) new_x = new_center_x - m_size [ 0 ] // 2 - pivot_c_x new_y = new_center_y - m_size [ 1 ] // 2 - pivot_c_y return new_x , new_y , muzzle
rotate pygame surface surf along specified pivot
rotate pygame surface surf along specified pivot
""" rotate pygame surface surf along specified pivot
    """
surf
pivot_x
pivot_y
angle