nunziox Posted May 29, 2014 Share Posted May 29, 2014 I have problem when i restart the game! I do it with this line of code this.game.state.start('BootState');The problem is that when the game restarted there are strange behaviours during the game. How can i delete all data for each state and reboot the game from the first state! Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 29, 2014 Share Posted May 29, 2014 You can in each state use the function shutdown and use the method destroy with your objects, stop timers, removeKey for keyboard events... Link to comment Share on other sites More sharing options...
nunziox Posted May 29, 2014 Author Share Posted May 29, 2014 can you write me an example code? Link to comment Share on other sites More sharing options...
j0hnskot Posted May 29, 2014 Share Posted May 29, 2014 you need to implement the shutdown() . Lets say you got a sprite that needs destroying:shutdown: function(){ sprite.destroy()}this function will get called just before the next state is loaded. Link to comment Share on other sites More sharing options...
Recommended Posts