import pygame
import time
pygame.init()
#1. 创建窗口
screen = pygame.display.set_mode((480,852),0,32)
#2. 创建一个背景图片
background = pygame.image.load("./feiji/background.png")
screen.blit(background,(0,0))
#3. 创建一个飞机图片
hero = pygame.image.load("./feiji/hero1.png")
screen.blit(hero,(150,300))
pygame.display.update()
clock = pygame.time.Clock()
hero_rect =pygame.Rect(150,300,102,126)
while True:
clock.tick(60)
hero_rect.y -= 1
screen.blit(background,(0,0))
screen.blit(hero,hero_rect)
pygame.display.update()
pygame.quit()
网友评论