phaser游戏

6. 交互

6.2. 当拖放时

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

        gameObject.setTint(0xff0000);

    });


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

        gameObject.x = dragX;

        gameObject.y = dragY;

    });


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

        gameObject.clearTint();

    });