Commit de20ed43 by BellCodeEditor

save project

parent 9ae59211
Showing with 6 additions and 6 deletions
...@@ -39,7 +39,7 @@ y = 400 ...@@ -39,7 +39,7 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
road_x=0 road_x=0
gamestate=0 gamestate= True
time=0 time=0
bg_x=0 bg_x=0
...@@ -52,7 +52,7 @@ while True: ...@@ -52,7 +52,7 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
wukong=Player(hero[index]) wukong=Player(hero[index])
...@@ -64,14 +64,14 @@ while True: ...@@ -64,14 +64,14 @@ while True:
if jumpState == "up": # 起跳状态 if jumpState == "up": # 起跳状态
if t > 0: if t > 0:
y -= t y -= t
wukong.rect.y=y wukong.rect.y = y
t -= 2 t -= 2
else: else:
jumpState = "down" jumpState = "down"
if jumpState == "down": # 降落状态 if jumpState == "down": # 降落状态
if t <= 30: if t <= 30:
y += t y += t
wukong.rect.y=y wukong.rect.y = y
t += 2 t += 2
else: else:
jumpState = "runing" jumpState = "runing"
...@@ -87,7 +87,7 @@ while True: ...@@ -87,7 +87,7 @@ while True:
road_x=0 road_x=0
screen.blit(road,(road_x,500)) screen.blit(road,(road_x,500))
screen.blit(wokong.image,(150,y)) screen.blit(wukong.image,(150,y))
time+=1 time+=1
...@@ -102,7 +102,7 @@ while True: ...@@ -102,7 +102,7 @@ while True:
screen.blit(sprite.image, (sprite.rect.x,sprite.rect.y)) screen.blit(sprite.image, (sprite.rect.x,sprite.rect.y))
if sprite.rect.x<=0-sprite.rect.width: if sprite.rect.x<=0-sprite.rect.width:
sprite.kill() sprite.kill()
if pygame.sprite.collide_rect(wokong,sprite): if pygame.sprite.collide_rect(wukong,sprite):
gameover=pygame.image.load("gameover.png") gameover=pygame.image.load("gameover.png")
screen.blit(gameover,(400,200)) screen.blit(gameover,(400,200))
gamestate=False gamestate=False
......
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