坦克大战有很多装备。然后还有等级,捡了可以升级.
// 装备
TankWar.prototype.materials = function () {
const { materials } = constants.texture;
const id = this.loader.resources.spaceship.spritesheet;
this.zhuangbeiContainer = new PIXI.Container();
Object.keys(materials).map((item, i) => {
const zhuangbei = new PIXI.Sprite(id.textures[materials[item]]);
zhuangbei.visible = false;
zhuangbei.position.set(80 * (i + 1), 40 * (i + 1));
zhuangbei.name = materials[item];
zhuangbei.anchor.set(0.5, 0.5);
//如果玩家和坦克都设置了锚点,坦克也需要设置锚点
//zhuangbei.scale.set(2,2);
this.zhuangbeiContainer.addChild(zhuangbei);
});
this.application.stage.addChild(this.zhuangbeiContainer);
};
设置生命值:
this.player.health = 1;
设置碰撞事件:
if (this.zhuangbeiContainer && this.player) {
//.... to do
}