Commit 57430781 by BellCodeEditor

save project

parent ae5ed95e
Showing with 4 additions and 10 deletions
...@@ -16,7 +16,6 @@ hero = [pygame.image.load('hero1.png'), ...@@ -16,7 +16,6 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png'),] pygame.image.load('hero5.png'),]
index = 0 index = 0
jumpStste = "runing" jumpStste = "runing"
y = 400 y = 400
...@@ -30,25 +29,20 @@ while True: ...@@ -30,25 +29,20 @@ while True:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpStste ="up" jumpStste ="up"
if jumpStste =="up": if jumpStste =="up":
if t>0: if y > 150:
y -=t y -=5
t -=2
else: else:
jumpStste = "down" jumpStste = "down"
if jumpStste =="down": if jumpStste =="down":
if t<=30: if y < 400:
y += t y +=40
t +=2
else: else:
jumpStste = "runing" jumpStste = "runing"
t = 30
wukong = hero[index] wukong = hero[index]
index +=1 index +=1
if index == 5: if index == 5:
index =0 index =0
if jumpStste == "up" or jumpStste =="down":
index = 0
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
......
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