Jump to content

Best way to handle if Game is Booted


jim716
 Share

Recommended Posts

I would like to use the Phaser loader (game.load) to load a configuration json file prior to calling my boot state.  

 

I know that I can do so, but have to wait until the game object is booted.  What is the correct way to know when the game object is booted, so the load object is initialized?  Waiting in a timed loop for isBooted seems like the wrong approach.

 

I've tried assigning my own function to device.whenReady and oddly it seems to work, but I'm concerned this is not the correct approach either.

 

Any advice is appreciated.

 

Link to comment
Share on other sites

If you're using states then the "create" method of the state won't be called until everything in "preload" is done. If you're using "game.load" you're good. Are you not seeing this behavior?

 

EDIT: If you're not using states then you should start; that would solve your problem, I think.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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