Commit 294d3c2d by BellCodeEditor

save project

parent 0e45e6a8
Showing with 3 additions and 16 deletions
......@@ -13,26 +13,13 @@ cacti = pygame.image.load('cacti.png') # 仙人掌
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')]
index = 0
y=400
jump='gay'
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE:
jump='up'
if jump=='up' :
if y>150:
y-=20
else:
jump='down'
if jump=='down' :
if y<400:
y+=20
else:
jump='gay'
# 将背景图画上去
wukong0=hero[index]
index=index+1
......@@ -41,7 +28,7 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong0, (150, y))
screen.blit(wukong0, (150, 400))
pygame.display.set_caption("悟空跑酷")
# 刷新画面
......
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