Jump to content

Subscribe to onUpdate


Recommended Posts



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


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...