Castellvi Posted January 8, 2015 Share Posted January 8, 2015 This may be a silly question, but I've been searching and I coldn't find nothing. I just want to add a button on my game main menu to exit my app, what do I have to call on phaser to do this? I've been searching in the documentation of Phaser.Game and Phaser.StateManager, but nothing seems to do this :/ Thanks! Link to comment Share on other sites More sharing options...
MichaelD Posted January 8, 2015 Share Posted January 8, 2015 What do you mean exit the game? I suppose you are using some kind of platform? Like Cordova/Phonegap or something similar? Also your game is viewed on a mobile device? Because for a web-game, I would say going back to some state like menu or an intro would equal a "close". Link to comment Share on other sites More sharing options...
Castellvi Posted January 9, 2015 Author Share Posted January 9, 2015 Thank you MichaelD for your answer, I forgot to specify it, I'm using Cocoonjs to build de project, and the project is menat to be for android and ipad tablets. In my main menu I have some buttons like "start game" and "Exit", I want the "Exit" button to close the app. In android you can use the default navigation bar to do this, but not with the ipad.Also, when I'm playing the the game (not in the main menu) and I press the "Back" button of the android navigation bar, it exits the game, and I'd like it to go back to the Main Menu while in game. Hope that I've explained it more clearly, thanks. Link to comment Share on other sites More sharing options...
jorgesereno Posted January 9, 2015 Share Posted January 9, 2015 I use in my games (phaser/phonegap to create android apk) some image button that calls this function:exitButtonClick: function () { if (confirm("Exit FlyTime?")) { navigator.app.exitApp(); };};worked for me. Link to comment Share on other sites More sharing options...
Castellvi Posted January 12, 2015 Author Share Posted January 12, 2015 This didn't work for me, nor in android or ios It gives me a "Cannot call method 'exitApp' of undefined" exception Link to comment Share on other sites More sharing options...
Recommended Posts