Hi there, I have the following code which works in the create function:
invy1 = this.add.image(((window.innerWidth/2) - (20)), ((-29) + (window.innerHeight))).setScrollFactor(0).setDisplaySize(30, 30).setDepth(10).setInteractive();
this.input.setDraggable(invy1);
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
gameObject.x = dragX;
gameObject.y = dragY;
});
However, once I introduce the following switch case I have in my update function, the image is no longer draggable and I have no idea why:
switch(x[0]) {
case "stone":
invy1.setTexture('star').setDisplaySize(45, 45);
break;
case "wood":
invy1.setTexture('wood').setDisplaySize(45, 45);
break;
case "bush":
invy1.setTexture('bush').setDisplaySize(45, 45);
break;
default:
invy1.setTexture('transparent');
break;
}