Commit f4d312ec by BellCodeEditor

save project

parent a897f605
Showing with 2 additions and 6 deletions
...@@ -53,7 +53,6 @@ time = 0 ...@@ -53,7 +53,6 @@ time = 0
gamestate = True gamestate = True
score = 0 score = 0
speed = 8 speed = 8
old_score = 0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
while True: while True:
...@@ -115,16 +114,13 @@ while True: ...@@ -115,16 +114,13 @@ 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:
score += sprite.score score += sprite.score
music.play()
sprite.score = 0 sprite.score = 0
print(score)
sprite.kill() sprite.kill()
if pygame.sprite.collide_rect(wukong, 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
if score > old_score :
music.play()
old_score = score
info = "Score:" + str(score) info = "Score:" + str(score)
my_font = font.render(info,True,(0,0,0)) my_font = font.render(info,True,(0,0,0))
screen.blit(my_font,(880,20)) screen.blit(my_font,(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