Jump to content

The gamepad buttons do not respond with the game on pause


AlexArroyoDuque
 Share

Recommended Posts

Hi! 
In my game you can play with a keyboard and a gamepad. With keyboard I can pause the game and execute other actions, for example can I unpause the game. 
 
However with the gamepad the player can pause the game but can not execute actions buttons gamepad with the game on pause.
 
    //pause    this.actionControls.pauseKey.onDown.add(utils.pauseMenu, this);    this.actionControls.pausePad.onDown.add(utils.pauseMenu, this);    //utils.pauseMenu unpause the game if the game on pause

 

 
 
Any help? 
 
 
A greeting!
Link to comment
Share on other sites

I use the example that you mentioned @valueerror. The problem is that it does not work with the button assigned to gamepad. Keyboard works perfectly.

 

Is possible unpause game with a gamepad button?   :(  :(  :(  :(  :(

 
     this.pad1 = this.game.input.gamepad.pad1;     this.game.input.gamepad.start();     this.actionControls = {        'pauseButton': this.game.input.keyboard.addKey(13), // ENTER        'pausePad': this.input.gamepad.pad1.getButton(Phaser.Gamepad.BUTTON_6)     };    this.actionControls.pauseButton.onDown.add(utils.pauseMenu, this);    this.actionControls.pausePad.onDown.add(utils.pauseMenu, this);    utils.pauseMenu = function () {        this.game.paused = !this.game.paused;    }
Link to comment
Share on other sites

oh..sorry..  didn't read your post carefully enough.. unfortunately i have no solution for you..   maybe create an "unpause" event listener not on the game (canvas) but on the window?

 

because the phaser game is paused it doesn't catch the buttonpress.. it doesn't listen.. but the rest of the browser does..

Link to comment
Share on other sites

Hello. 

That idea has been good :)

But I tried with the gamepad API, sometimes detected the gamepad and sometimes not ...

 


 



window.addEventListener("gamepadconnected", function(e) {
console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
e.gamepad.index, e.gamepad.id,
e.gamepad.buttons.length, e.gamepad.axes.length);
});

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
On 6/22/2016 at 0:48 AM, Tilde said:

Adding gamepad support to my game, and I'm pretty sure this is still a problem.

I can confirm that it still is. I'll have to figure out some ungodly way to "pause" all physics one by one so that the gamepad can be used to "unpause". Minor wart -- the framework's still awesome.

Update (for any future adventurers who show up here):

I found an issue on github: https://github.com/photonstorm/phaser/issues/2179 . It seems this is an inherent limitation of the way the gamepad api is wired into Phaser. The issue is closed without a resolution so you can be certain this will not be addressed in the current 2.x version of Phaser.

Edited by Ni Axi
Found additional info
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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