1

I am trying to add Spine into my project, older versions of of Phaser won't load my Spine, the newest (3.45.0) works fine. But drag and drop doesn't work in 3.45.0. Older versions, my drag and drop works with no problem. My game object says draggable = true... Any help would be appreciated.

<script src="//cdn.jsdelivr.net/npm/phaser@3.54.0/dist/phaser.min.js"></script>
<script src="./libraries/SpinePlugin.min.js"></script>
config = {
  type: Phaser.AUTO,
  //mode: Phaser.Scale.FIT,
  parent: "content",
  width: windWide,
  height: windHigh,
  physics: {
      default: "arcade",
      arcade: {
        debug: true,
     
    }
      },
  dom: {
      createContainer: true
  },
  scene:[
    LoadScene, MenuScene, UIScene, TurnDevice, Review, Vocab, ListenMatch, Spell, WordImageMatch, GameScene
  ],
  plugins: {
    scene: [
        { key: 'SpinePlugin', plugin: window.SpinePlugin, mapping: 'spine' }
    ]
  }
this.load.spine('eggBreak', 'src/assets/json/eggBreak.json', 'src/assets/json/eggBreak.atlas');
this.load.spine('eggWhole', 'src/assets/json/eggWhole.json', 'src/assets/json/eggWhole.atlas');
  let egg = _this.add.spine(windWide*.5, windHigh*.25, 'eggWhole', 'idle', true)
  this.physics.add.existing(egg);
     
  let hammer = this.physics.add.image(windWide*.5, windHigh*.85, "hammer").setInteractive()
       
    this.input.setDraggable(hammer);

    this.input.on('drag', function (pointer, gameObject, dragX, dragY) {

         gameObject.x = dragX;
         gameObject.y = dragY;
                    
     });

I am trying to smash an egg with a hammer, if you can tell by the code.

Thanks

Magnus
  • 11
  • 1
  • Update - dragstart and dragend both trigger, as I can get a console.log out of them, drag and drop inputs - no response – Magnus Apr 29 '21 at 10:14

1 Answers1

0

The fix - remove:

dom: {
      createContainer: true
  },

The container was interfering with the drag. Thanks to Milton on https://phaser.discourse.group/t/drag-and-drop-not-working/9424/2 for your help!

Magnus

Magnus
  • 11
  • 1