Jump to content

Mouse listener (one button)


Recommended Posts



I have a quick question, I've been searching around for an answer that would work for me but can't find one so here goes;


The game I'm trying to make have a targeting system, meaning I can click on another sprite to make my main sprite shot bullets on it, for this I've been using:

this.TARGET_SPRITE.events.onInputDown.add(ATTACK_FUNCTION, this);

However, this occupy both my mouse buttons, is there a way to use the same method but somehow track which of the input buttons I just pressed down? Do I have to use like "game.input.activePointer.leftButton.isDown" in the update loop or is there a way to create a passive listener like the one I'm using now (but for only one button)?


Sorry if it's a stupid question, I'm still learning!


Thanks in advance!

// Alex

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.

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