Commit 51f85eb3 by BellCodeEditor

save project

parent 459e6e97
Showing with 7 additions and 2 deletions
...@@ -14,6 +14,7 @@ cacti = pygame.image.load('cacti.png') # 仙人掌 ...@@ -14,6 +14,7 @@ cacti = pygame.image.load('cacti.png') # 仙人掌
apple = pygame.image.load('bush.png') # 灌木丛 apple = pygame.image.load('bush.png') # 灌木丛
hero=['hero1.png','hero2.png','hero3.png','hero4.png','hero5.png'] hero=['hero1.png','hero2.png','hero3.png','hero4.png','hero5.png']
index = 0 index = 0
x=0
y=400 y=400
jumpstart="run" jumpstart="run"
while True: while True:
...@@ -25,16 +26,20 @@ while True: ...@@ -25,16 +26,20 @@ while True:
if event.key ==locals.K_SPACE: if event.key ==locals.K_SPACE:
if jumpstart == "run": if jumpstart == "run":
jumpstart="up" jumpstart="up"
x=30
if jumpstart == "up": if jumpstart == "up":
if y>150: if y>150:
y-=5 y-=x
x-=2
else: else:
jumpstart="down" jumpstart="down"
if jumpstart == "down": if jumpstart == "down":
if y<400: if y<400:
y+=5 y+=x
x+=2
else: else:
jumpstart="run" jumpstart="run"
y=400
wukong=pygame.image.load(hero[index]) wukong=pygame.image.load(hero[index])
if jumpstart == "run": if jumpstart == "run":
index+=1 index+=1
......
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