Commit 9d73df99 by BellCodeEditor

save project

parent 0367a8c3
Showing with 33 additions and 5 deletions
......@@ -129,7 +129,7 @@ while True:
sprite.kill()
if pygame.sprite.collide_rect(wukong, sprite): # 精灵碰撞检测
gameover = pygame.image.load('gameover.png') # 游戏结束
screen.blit(gameover, (400, 200))
if die :
gamestate = False
if score > one:
......@@ -163,4 +163,33 @@ while True:
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(60)
else:
screen.blit(gameover, (400, 200))
pygame.display.update()
for event in pygame.event.get():
mouse = pygame.mouse.get_pos()
mousex = mouse[0]
mousey = mouse[1]
print(mousex,mousey)
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.MOUSEBUTTONDOWN:
# if mousex >= 400 and mousex <= 400+206 and mousey >= 200+57 and mousey <= 200:
for sprite in block_list:
sprite.kill()
if score > one:
record["第3名"]=record["第2名"]
record["第2名"]=record["第1名"]
record["第1名"]=score
elif score>two:
record["第3名"]=record["第2名"]
record["第2名"]=score
else:
record["第3名"]=score
with open('record.txt','w',encoding='utf-8') as f:
f.write(json.dumps(record,ensure_ascii=False))
gamestate = True
{"第1名": 12, "第2名": 8, "第3名": 7}
\ No newline at end of file
{"第1名": 12, "第2名": 10, "第3名": 9}
\ 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