danbruegge Posted May 7, 2014 Share Posted May 7, 2014 HI, How can i detect a button is pressed, not just clicked? That drives me mad. I can't figure out how it will work. With the keyboard it simply works. But with mouse and touch...meh. Can someone help? Link to comment Share on other sites More sharing options...
stasuss Posted May 7, 2014 Share Posted May 7, 2014 You can use Phaser signal "onInputDown" like this:yourButton.onInputDown.add(function() { console.info('down'); }, this); Link to comment Share on other sites More sharing options...
danbruegge Posted May 7, 2014 Author Share Posted May 7, 2014 This will fire only one i clicked. Not if i keep the mouse button down. Or i do something wrong. Link to comment Share on other sites More sharing options...
stasuss Posted May 7, 2014 Share Posted May 7, 2014 Then I advice you to use global var containing the state of the button and change its value in the listeners of the onInputDown and onInputUp signals. So you can make use of this var in the update event of the game. Link to comment Share on other sites More sharing options...
danbruegge Posted May 7, 2014 Author Share Posted May 7, 2014 Ahh nice! That's what i'm looking for! Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts