[Python] 纯文本查看 复制代码 import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((800, 600))
background = pygame.image.load('image/星海背景.png')
alarm = pygame.image.load('image\警报器.png')
spaceship = pygame.image.load('image\战舰.png')
storage = pygame.image.load('image\反应仓.png')
push = pygame.image.load('image\弹出按钮.png')
site = [100, 100]
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
site[1] -= 8
if event.key == pygame.K_DOWN:
site[1] += 8
if event.key == pygame.K_LEFT:
site[0] -= 8
if event.key == pygame.K_RIGHT:
site[0] += 8
screen.blit(background, (0, 0))
screen.blit(alarm, site)
screen.blit(spaceship, (0, 50))
screen.blit(storage, (0, 150))
screen.blit(push, (0, 400))
pygame.display.update()
|