Klaus Posted April 28, 2015 Share Posted April 28, 2015 Hey, Hopefully a quick question. I'm wondering if it's possible to subscribe custom methods to the current state's onUpdate event. E.g. I don't only want the onUpdate method of the current state to be called, but also some other custom method of mine as well. The reason behind this is basically code-structure. I'd like my input handler to be in a separate file with seperate methods, and for it to also be able to work in the onUpdate rythm. Also, I'd like it to be independent from a particular gamestate. It should just work whatever state is currently running. E.g. I don't want to manually invoke the custom method in all of the state's update methods. Thanks and Cheers P.S.: I'm currently working with TypeScript instead of JavaScript, just in case that has any influence. Link to comment Share on other sites More sharing options...
rich Posted April 29, 2015 Share Posted April 29, 2015 Create a base state class that has all of your "custom" handlers in. Then extend it for all of the other states. Then you've access to everything. Link to comment Share on other sites More sharing options...
Recommended Posts