Commit 7052df08 by BellCodeEditor

save project

parent 706ff550
Showing with 8 additions and 3 deletions
......@@ -42,7 +42,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
basic_font=pygame.font.Font('STKAITI.TTF',18)
basic_font=pygame.font.Font('STKAITI.TTF',30)
score_audio=pygame.mixer.Sound('score.wav')
index = 0
......@@ -56,6 +56,7 @@ gamestate = True
score=0
speed=8
old_score=0
again=0
block_list =pygame.sprite.Group() # 创建精灵组
......@@ -133,6 +134,9 @@ while True:
gameover = pygame.image.load('gameover.png') # 游戏结束
screen.blit(gameover,(400, 200))
gamestate = False
if gamestate==False:
m=basic_font.render("游戏结束,按任意键重新开始",True,(60,90,60))
screen.blit(m,(350,300))
if score>one:
record["第1名"]=score
record["第2名"]=one
......@@ -146,6 +150,7 @@ while True:
with open('record.txt','w',encoding='utf-8') as f:
f.write(record)
else:
if sprite.rect.x+sprite.rect.width<wukong.rect.x:
score+=sprite.score
......
{"第1名": 8, "第2名": 4, "第3名": 1}
\ No newline at end of file
{"第1名": 13, "第2名": 12, "第3名": 8}
\ No newline at end of file
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