const config = { count: 5, // 默认倒计时时长 duration: 60, // 总时长 s level: 1, // 游戏难度级别 total: 100, // 总分 times: 20, // 动作次数 }; let library = null; let state = 0; // 游戏状态 0->未开始 1->进行中 2->结束 function initStage(lib) { library = lib; window.main = Main.of(gameOver); // 初始化鸟等 window.timeInstance = Time.of(gameOver); // 初始化游戏时间 // window.soundInstance = Sound.of(); // 初始化音频 Level.of(2); // 游戏难度级别 Back.of(); // 返回按钮 } // 游戏结束 显示结束得分面板 function gameOver() { state = 2; const times = main.times; const score = parseInt((config.total / config.times) * times); End.of(score); }