[英]pygame how to rotate image properly?
在pygame中,我無法旋轉圖像/表面。 圖像繪制正確,只是沒有旋轉。
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))
我到底在做什么錯?
1.-您使用的是哪個版本(pygame和python)?
2.-您不需要弧度
3.-您必須指定一個問題,說明似乎模棱兩可
無論如何,我在這里留下一個例子。 祝好運。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.