# 1。导包
import pygame
# 2,初始化
pygame.init()
# 3。设置窗口大小
ping_mu = pygame.display.set_mode((400,700))
# 图片1 导入图片
beijin = pygame.image.load("beijing.jpg")
huiji = pygame.image.load("huiji.png")
diji = pygame.image.load("diji.png")
dijiy=0
huijix = 200
huijiy = 300
# 4。无限循环刷新
while 1>0:
for i in pygame.event.get():
if i.type == pygame.QUIT:
pygame.quit()
elif i.type == pygame.KEYDOWN:
if i.key == pygame.K_a:
huijix = huijix-20
if i.key == pygame.K_d:
huijix = huijix + 20
if i.key == pygame.K_w:
huijiy = huijiy - 20
if i.key == pygame.K_s:
huijiy = huijiy + 20
# 左边空气墙
if huijix < -50:
huijix = -10
if huijix > 400:
huijix = 380
if huijiy < 0:
huijiy = 100
dijiy=dijiy+1
# 图片2放窗口上
ping_mu.blit(beijin,(0,0))
ping_mu.blit(huiji,(huijix,huijiy))
ping_mu.blit(diji,(150,dijiy))
pygame.display.update()
xinxin - 飞机大战2.0
最新推荐文章于 2021-04-13 20:33:42 发布