1

I try to rotate my canon in pygame

The problem ist that with

pygame.transform.rotate()

The rotation is about the center which obviously is not the correct rotation point for the gun. So how can i move the rotation point ~20px from the center down?

This is my initialization of the gun:

self.image = pygame.image.load("./assets/Tower/MiniGun.png").convert_alpha()
self.rect = self.image.get_rect()
self.rect.center = (80, 250)
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
MW00
  • 95
  • 1
  • 9
  • 1
    `pygame.transform.rotate()` does not rotate around the center. A _Surface_ has no location. `pygame.transform.rotate()` just creates a new and rotated _Surface_. The trick is to find the correct position of the top left edge of the rotated _Surface_. See [How can you rotate an image around an off center pivot in PyGame](https://stackoverflow.com/questions/59909942/how-can-you-rotate-an-image-around-an-off-center-pivot-in-pygame/59909946#59909946/59909946#59909946) – Rabbid76 Feb 08 '21 at 20:52

0 Answers0