我那么一大片文章莫名其妙没有了。。。
也找不回来了。。。
随便写一点吧。。。
继承
function inheritPrototype(subType, superType) {
// 修正子类原型对象指针,指向父类原型的一个副本
subType.prototype = Object.create(superType.prototype)
// 增强对象,弥补因重写原型而失去的默认的constructor属性
subType.prototype.constructor = subType
}
function ExternalScene() {
Phaser.Scene.call(this, 'myScene')
}
inheritPrototype(ExternalScene, Phaser.Scene)
ExternalScene.prototype.preload = function () {
this.load.image('face', 'http://labs.phaser.io/assets/pics/bw-face.png');
this.load.image('arrow', 'http://labs.phaser.io/assets/sprites/longarrow.png');
};
ExternalScene.prototype.create = function () {
this.face = this.add.image(400, 300, 'face');
this.arrow = this.add.sprite(400, 300, 'arrow').setOrigin(0, 0.5);
};
ExternalScene.prototype.update = function () {
this.arrow.rotation += 0.01;
};