坦克大战有很多装备。然后还有等级,捡了可以升级.

    1. // 装备
    2. TankWar.prototype.materials = function () {
    3. const { materials } = constants.texture;
    4. const id = this.loader.resources.spaceship.spritesheet;
    5. this.zhuangbeiContainer = new PIXI.Container();
    6. Object.keys(materials).map((item, i) => {
    7. const zhuangbei = new PIXI.Sprite(id.textures[materials[item]]);
    8. zhuangbei.visible = false;
    9. zhuangbei.position.set(80 * (i + 1), 40 * (i + 1));
    10. zhuangbei.name = materials[item];
    11. zhuangbei.anchor.set(0.5, 0.5);
    12. //如果玩家和坦克都设置了锚点,坦克也需要设置锚点
    13. //zhuangbei.scale.set(2,2);
    14. this.zhuangbeiContainer.addChild(zhuangbei);
    15. });
    16. this.application.stage.addChild(this.zhuangbeiContainer);
    17. };

    设置生命值:

    1. this.player.health = 1;

    设置碰撞事件:

    1. if (this.zhuangbeiContainer && this.player) {
    2. //.... to do
    3. }