Jump to content

How to add callbacks to specific inputs?


Arcanorum
 Share

Recommended Posts

The following can be used to add a callback to input events, but from my understanding the callback will be run when any mousePointer, pointer1, pointer2, etc. are pressed down.

this.input.onDown.add(function (pointer) {
    // code here
}, this);

Is there a way to add callbacks to specific inputs? I have tried

this.input.mousePointer.onDown.add(function () {
    // code here
}

but this gives an error.

Link to comment
Share on other sites

You can create your own custom signal using game.input.activePointer.leftButton.isDown, not sure if phaser already has a callback for specific buttons pressed.

Failing that, you could always create specific inputs for this: http://phaser.io/examples/v2/input/multi-touch

Haven't tested so not sure if it's exactly what you need, but I'd be curious to see if these help at all?

Nick

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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