AlexArroyoDuque

The gamepad buttons do not respond with the game on pause

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!

Share this post


Link to post
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;    }

Share this post


Link to post
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..

Share this post


Link to post
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);
});

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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.

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

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.