Commit 8aa5ac8a by BellCodeEditor

auto save

parent 831f522b
Showing with 9 additions and 3 deletions
...@@ -14,15 +14,21 @@ apple = pygame.image.load('bush.png') # 灌木丛 ...@@ -14,15 +14,21 @@ apple = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')] hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')]
index = 0 index = 0
pygame.display.set_caption("悟空跑酷") pygame.display.set_caption("悟空跑酷")
y=400
j="run"
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if index==len(hero)-1: if event.key == locals.KEYDOWN:
index=0 if event.key == locals.K_SPACE:
index=index+1
wukong=hero[index] wukong=hero[index]
index=index+1
if index>=5:
index=0
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment