Jump to content

Drag and drop doesnt work


Recommended Posts

Hi Guys,

I am quite new here, I am trying to implement drag and drop and the drag event alone isn't firing.[dragstart and dragend are working] below is the code. Can someone help me to figure out the issue,

 this.tile = this.add.image(this.cameras.main.width * initialX,this.cameras.main.height * initialY,this.puzzlePiecesArr[index]).setScale(0.1).setInteractive({ draggable: true });
        this.tile.input.draggable = true;

        this.input.on('dragstart', function (pointer, gameObject) {

        this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
            gameObject.x = dragX;
            gameObject.y = dragY;

       this.input.on('dragend', function (pointer, gameObject) {


Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...