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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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