pygame不断旋转地动画练习答案

"""
   pygame不断旋转地动画练习答案。
   本程序会让一张女孩图片不断地旋转。
"""
import pygame
   
image = "girl.png"
width,height = 480,360
中心点 = width//2,height//2
screen = pygame.display.set_mode((width,height))
pygame.display.set_caption("pygame不断旋转的动画")

image = pygame.image.load(image).convert_alpha()
image_rect = image.get_rect(center=中心点) # 获取矩形对象
screen.blit(image,image_rect)              # 渲染在screen上
pygame.display.update()                    # 更新显示

angle = 1
while not pygame.event.get(pygame.QUIT):
    
    image2 = pygame.transform.rotate(image,angle) # 逆时针旋转angle度
    image2_rect = image2.get_rect(center=中心点)

You must log in to read the rest of this article. Please log in or register as a user.