Chendler Posted September 19, 2014 Share Posted September 19, 2014 Hello. I set game.pause when user clicks ESC button.But how to catch button click (keyboard TAB or ENTER) when game is paused? Thank you. p.s. And may be phaserjs has another way to make the game available for keyboard users? (user clicks TAB and buttons highlights, then user clicks ENTER and it's such as click on the button) Link to comment Share on other sites More sharing options...
lewster32 Posted September 19, 2014 Share Posted September 19, 2014 States have a pauseUpdate function which is called just like update, but when the game is paused. Chendler 1 Link to comment Share on other sites More sharing options...
Chendler Posted September 19, 2014 Author Share Posted September 19, 2014 Thank you, lewster. I have one more question to solve my problem.How to call button callback manually? Button doesn't have callback property and I didn't find something similar. Now I just put my callback in custom property of my button. Link to comment Share on other sites More sharing options...
lewster32 Posted September 19, 2014 Share Posted September 19, 2014 I'm not sure I entirely understand what you mean? The callback you specify when you create a button is added to the button.onInputUp Signal. If you've set it to an accessible named function, you can just call that function:function doSomething() { // do something here}var button = this.game.add.button(0, 0, 'button', doSomething, this);// You can call doSomething manually now it's been defineddoSomething();If you do not specify a callback in the constructor, then you'll have to add it manually:function doSomething() { // do something here}var button = this.game.add.button(0, 0, 'button');button.onInputUp.add(doSomething, this); Link to comment Share on other sites More sharing options...
Recommended Posts