Jump to content

Game update while using State?


datvm
 Share

Recommended Posts

Recently I need to update a HTML element from the game each frame. The box element itself is seperated, and my game use States. I also realize if I use State, the update method of the Game is never called. Is there any "global" update that I can use, no matter which State I am using?

Link to comment
Share on other sites

Phaser always has at least 1 State running, and if present it will call the update method of that state. If you break your game up into multiple states only one of those can be active at any one time - and only that states update method will be called. So if you have important stuff going on in another state, then change state, it will stop firing - so you need to restructure your code to deal with this.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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