Commit 562bbfe7 by BellCodeEditor

save project

parent 2cbbe4bb
Showing with 5 additions and 3 deletions
...@@ -90,7 +90,7 @@ while True: ...@@ -90,7 +90,7 @@ while True:
t += 2 t += 2
else: else:
jumpState = "runing" jumpState = "runing"
t =30 t = 30
# 将背景图画上去 # 将背景图画上去
bg_x -= 1 bg_x -= 1
...@@ -113,7 +113,7 @@ while True: ...@@ -113,7 +113,7 @@ while True:
obstacle = Block(bush,cacti,stone) obstacle = Block(bush,cacti,stone)
block_list.add(obstacle) block_list.add(obstacle)
for sprite in block_list: # 遍历、展示障碍物精灵 for sprite in block_list: # 遍历、展示障碍物精灵
sprite.rect.x -= 8 sprite.rect.x -= speed
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()
...@@ -125,7 +125,9 @@ while True: ...@@ -125,7 +125,9 @@ while True:
if (sprite.rect.x + sprite.rect.width) <wukong.rect.x: if (sprite.rect.x + sprite.rect.width) <wukong.rect.x:
score += sprite.score score += sprite.score
sprite.score = 0 sprite.score = 0
if score > old_score
score_audio.play()
old_score = score
scoreSurf = basic_font.render("分数:"+str(score),True,(255,255,255)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,255,255))
......
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