Commit ace00633 by BellCodeEditor

save project

parent 83558747
Showing with 11 additions and 5 deletions
...@@ -19,7 +19,8 @@ hero4 = pygame.image.load('hero4.png') ...@@ -19,7 +19,8 @@ hero4 = pygame.image.load('hero4.png')
hero5 = pygame.image.load('hero5.png') hero5 = pygame.image.load('hero5.png')
wukong = [hero1,hero2,hero3,hero4,hero5] wukong = [hero1,hero2,hero3,hero4,hero5]
index = 0 index = 0
indey=400 indey = 400
jumpState = "running"
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:
...@@ -27,12 +28,17 @@ while True: ...@@ -27,12 +28,17 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState="up"
if jumpState=="up":
if indey>150: if indey>150:
for i in range(50): indey-=10
indey-=5
else: else:
for i in range(50): jumpState="down"
indey+=5 if jumpState=="down":
if indey<400:
indey+=10
else:
jumpState="running"
zaoxing = wukong[times] zaoxing = wukong[times]
times+=1 times+=1
if times>=5: if times>=5:
......
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