Anderberg Posted May 20, 2014 Share Posted May 20, 2014 Is there any easy way to set a general state shutdown callback function? What I am looking for is essentially a listener. When a state is shutdown, a function should be called.When using states I can create a shutdown function, but that one is only triggered in that specific state.Do I have to create a superclass that all my states inherit or is there another way? Link to comment Share on other sites More sharing options...
alex_h Posted May 20, 2014 Share Posted May 20, 2014 You could use a mixin instead of resorting to inheritance https://www.google.co.za/search?q=javascript+mixin Link to comment Share on other sites More sharing options...
Anderberg Posted May 20, 2014 Author Share Posted May 20, 2014 That is not a bad idea. However, I would still have to do it for every state I have.Perhaps I could just override the Phaser.State.prototype.shutdown function... I'll give it a try. Link to comment Share on other sites More sharing options...
Anderberg Posted May 20, 2014 Author Share Posted May 20, 2014 That did not work out very well.The Phaser.State.prototype.shutdown function is not used. A dummy function is used as default if the state does not have a specific shutdown function. Link to comment Share on other sites More sharing options...
Recommended Posts