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.
34 lines
714 B
34 lines
714 B
/**
|
|
* 难度等级类
|
|
* @param {number} level 等级数字代码
|
|
*/
|
|
function Level(level = config.level || 1) {
|
|
this.lib = library;
|
|
|
|
this.level = level;
|
|
}
|
|
|
|
/**
|
|
* 静态方法 封装new init 返回实例
|
|
* @param {number} level 等级数值
|
|
* @returns
|
|
*/
|
|
Level.of = function (level) {
|
|
const instance = new Level(level);
|
|
instance.init();
|
|
return instance;
|
|
};
|
|
|
|
// 初始化 渲染
|
|
// 更新config中的level属性
|
|
Level.prototype.init = function () {
|
|
const initX = this.lib.properties.width / 2;
|
|
const initY = 80;
|
|
const target = new this.lib.Level();
|
|
target.x = initX;
|
|
target.y = initY;
|
|
|
|
target.gotoAndStop(`level-${this.level}`);
|
|
config.level = this.level;
|
|
stage.addChild(target);
|
|
};
|
|
|