0
votes

I tried to make a game with PYGAME and I can't find a way to rotate that object from the top and not from the center

copy_img = pygame.transform.rotate(img,angle) # Rotation

screen.blit(copy_img,(gunX - int(copy_img.get_width() / 2),gunY - int(copy_img.get_height() / 2))) # Making a copy of the image to get the centre for a clean rotate

screen.blit(img_bird,(birdX,birdY)) # This is the bird it's (NOT IMPORTANT FOR THE ROTATION)

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        running = False
    if event.type == pygame.MOUSEMOTION: # If the mouse is moving
        x,y = pygame.mouse.get_rel() # Getting the direction of the mousemotion
        if x > 0: # If the mouse is moving right (RIGHT NOW IT'S MOVING THE RIGHT SIDE)
            angle += 2 # angle is the value of the rotation
        elif x < 0: # If the mouse is moving left
            angle -= 2 # angle is the value of the rotation (RIGHT NOW IT'S WILL ROTATE TO THE LEFT SIDE)