Commit aa9e5875 by BellCodeEditor

save project

parent ad298bb1
Showing with 8 additions and 6 deletions
...@@ -77,14 +77,14 @@ while True: ...@@ -77,14 +77,14 @@ while True:
if t > 0: if t > 0:
y -= t y -= t
wukong.rect.y = y wukong.rect.y = y
t -= 2 t -= 1
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 += 1
else: else:
jumpState = "runing" jumpState = "runing"
t =30 t =30
...@@ -118,10 +118,12 @@ while True: ...@@ -118,10 +118,12 @@ while True:
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
if obstacle.rect.x - obstacle.rect.width <= wukong.rect.x : if sprite.rect.x + sprite.rect.width < wukong.rect.x :
#pygame.mixer.music.play() score += sprite.score
score += obstacle.score sprite.score = 0
obstacle.score = 0 print(score)
if sprite.rect.x + sprite.rect.width in range(wukong.rect.x-7,wukong.rect.x+7) :
pygame.mixer.music.play()
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20)) screen.blit(scoreSurf,(850,20))
......
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