AlexArroyoDuque Posted October 18, 2014 Share Posted October 18, 2014 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! Tilde 1 Link to comment Share on other sites More sharing options...
valueerror Posted October 18, 2014 Share Posted October 18, 2014 it would be very VERY nice if phaser would do it as expected (unpause with a simple button) but it doesn't... so here is the way to go:http://examples.phaser.io/_site/view_full.html?d=misc&f=pause+menu.js&t=pause%20menu Tilde 1 Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted October 18, 2014 Author Share Posted October 18, 2014 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 More sharing options...
valueerror Posted October 19, 2014 Share Posted October 19, 2014 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 More sharing options...
AlexArroyoDuque Posted October 19, 2014 Author Share Posted October 19, 2014 Hello. That idea has been good But I tried with the gamepad API, sometimes detected the gamepad and sometimes not ... https://developer.mozilla.org/en-US/docs/Web/Guide/API/Gamepad 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 More sharing options...
Tilde Posted June 22, 2016 Share Posted June 22, 2016 Adding gamepad support to my game, and I'm pretty sure this is still a problem. Link to comment Share on other sites More sharing options...
Ni Axi Posted August 20, 2016 Share Posted August 20, 2016 (edited) 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 August 20, 2016 by Ni Axi Found additional info Link to comment Share on other sites More sharing options...
Recommended Posts