Jump to content

Events when game is paused


Chendler
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

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