2011-06-27 3 views
0

En pygame, je suis incapable de faire pivoter une image/surface. L'image dessine correctement et ne tourne pas.pygame comment faire pivoter l'image correctement?

self.other1 = pygame.image.load("enemy.png").convert_alpha() 
self.other2 = pygame.transform.rotate(self.other1, math.radians(270)) 
self.screen.blit(self.other2, (0, 0)) 

Que fais-je tort?

Répondre

5

1.- Quelle version utilisez-vous (pygame et python)?

Vous n'avez pas 2.- besoin radians

Vous devez spécifier 3.- un problème de votre description semble ambiguë

Quoi qu'il en soit, je laisse un exemple ici. Bonne chance.

import pygame 
from pygame.locals import * 

SIZE = 640, 480 
pygame.init() 
screen = pygame.display.set_mode(SIZE) 

done = False 
screen.fill((0, 0, 0)) 
other1 = pygame.image.load("enemy.png").convert_alpha() 
other2 = pygame.transform.rotate(other1, 270) 
screen.blit(other2, (0, 0)) 
pygame.display.flip() 

while not done: 
    for e in pygame.event.get(): 
     if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE): 
      done = True 
      break