azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 58 forks source link

problems about change part of slot attachment without use skins . #24

Closed zk-luke closed 7 years ago

zk-luke commented 7 years ago

I have a texture atlas made with texture packer.I want change part of slot with a image in texture packer atlas, i made the code below, but the image is invisible .

does phaser-spine can do this?

     var _outro = game.add.spine(400,400,"duck");
      var slot = _outro.skeleton.findSlot("bonus_duck");
      var image = new Phaser.Sprite(game, 0, 0, "texture_packer_atlas", "duckHunt_logo");
      image.anchor.setTo(0.5);

      var attachment = slot.attachment;
      attachment.rendererObject.texture = image;
      // slot.currentSprite.texture = image;

      _outro.setAnimationByName(1, "showing", false);
      _outro.setToSetupPose();

thanks.

zk-luke commented 7 years ago

I have worked it out. image should be added to slotContainer. thanks.

_outro.slotContainers[num].add(image);