AbdSab Posted December 16, 2014 Share Posted December 16, 2014 Hi all I have a big problem: At the game over scene which is in the same of the game state, i have two button replay and main menu When i click replay which have the function: this.game.state.restart(false,true); The state restart but when i click at the place where the button was, the state restate again. I think that the button is not destroyed just the sprite which is destroyed, i have tried button.kill() and button.destroy() before restating state but i get an error. And when i do : this.game.state.restart(); I get an error of an undefined velocity ......., The question is, is there any way to restart the state like if it's the first time the state is started ?? Link to comment Share on other sites More sharing options...
valueerror Posted December 16, 2014 Share Posted December 16, 2014 i do it with game.state.start(game.state.current); Link to comment Share on other sites More sharing options...
AbdSab Posted December 16, 2014 Author Share Posted December 16, 2014 But it's the same as this.game.state.restart();:'( EDIT:Nevermind i've found a way, it's to add this function: shutdown: function() { this.game.world.removeAll(); } Thank's anyway Link to comment Share on other sites More sharing options...
Recommended Posts