Commit 13ed1896 by BellCodeEditor

save project

parent f2819d28
Showing with 8 additions and 1 deletions
...@@ -41,6 +41,8 @@ hero = [pygame.image.load('hero1.png'), ...@@ -41,6 +41,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
zt = pygame.font.Font("STKAITI.TTF",18) zt = pygame.font.Font("STKAITI.TTF",18)
yy = pygame.mixer.Sound("score.wav")
index = 0 index = 0
y = 400 y = 400
...@@ -52,6 +54,7 @@ time = 0 ...@@ -52,6 +54,7 @@ time = 0
gamestate = True gamestate = True
score=0 score=0
speed=8 speed=8
old=0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
...@@ -122,7 +125,11 @@ while True: ...@@ -122,7 +125,11 @@ 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:
yy.play()
old = score
fs = zt.render("分数"+str(score),True,(255,255,255)) fs = zt.render("分数"+str(score),True,(255,255,255))
screen.blit(fs,(880,20)) screen.blit(fs,(880,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