0

No consigo que la imagen gire y se posiciona en unas coordenadas que no son. Este mismo código de rotación, en una ventana a parte, funciona perfectamente. El error está en que no aumenta progresivamente el current_angle, se queda en 0.02, no consigo ver por qué.

                if len(self.player_group) == 0:   

                    self.surf = pg.image.load("resources/nave/nave.png").convert_alpha()
                    self.current_angle = 0
                    self.rect = self.surf.get_rect(center=(700, 300))

                   if self.current_angle <= 180:    
                      self.current_angle += 0.02

                  self.texto.screen.blit(self.rot_center(self.surf,self.current_angle), self.rect)

         pg.display.flip()

         pg.display.update()



 def rot_center(self,image, angle):
     orig_rect = image.get_rect()
     rot_image = pg.transform.rotate(image, angle)
     rot_rect = orig_rect.copy()
     rot_rect.center = rot_image.get_rect().center
     rot_image = rot_image.subsurface(rot_rect).copy()
     return rot_image

1 respuesta 1

0

La posicion ya la he corregido cambiando

(center=(700, 300)) 

a

(x=700, y=300)

Rotacion operativa, la variable current_angle, debía estar en el init, y no ahí.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.