You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
748 B
28 lines
748 B
const config = {
|
|
count: 5, // 默认倒计时时长
|
|
duration: 10, // 总时长 s
|
|
level: 1, // 游戏难度级别
|
|
total: 100, // 总分
|
|
times: 20, // 动作次数
|
|
};
|
|
|
|
let library = null;
|
|
let state = 0; // 游戏状态 0->未开始 1->进行中 2->结束
|
|
|
|
function initStage(lib) {
|
|
library = lib;
|
|
|
|
window.bird = Bird.of(gameOver); // 初始化鸟等
|
|
window.timeInstance = Time.of(gameOver); // 初始化游戏时间
|
|
// window.soundInstance = Sound.of(); // 初始化音频
|
|
Level.of(2); // 游戏难度级别
|
|
Back.of(); // 返回按钮
|
|
}
|
|
|
|
// 游戏结束 显示结束得分面板
|
|
function gameOver() {
|
|
state = 2;
|
|
const times = bird.times;
|
|
const score = parseInt((config.total / config.times) * times);
|
|
End.of(score);
|
|
}
|
|
|