|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 斌小白 于 2020-12-16 08:40 编辑
elif life_num == 0:
pygame.mixer.music.stop()
# 背景音乐停止
pygame.mixer.stop()
# 停止全部音效
pygame.time.set_timer(SUPPLY_TIME, 0)
# 停止发放补给
if not recorded:
# 如果没有打开文本
recorded = True
with open('record.txt', 'r') as f:
record_score = int(f.read())
# 读取历史最高得分
if score > record_score:
with open('record.txt', 'w') as f:
f.write(str(score))
# 如果玩家得分高于历史最高得分,则存档
# 游戏结束设置
record_score_text = score_font.render('Best : %d' % record_score, True, (255, 255, 255))
screen.blit(record_score_text, (50, 50))
出现UnboundLocalError: local variable 'record_score' referenced before assignment 怎么解决 |
|