Jump to content

How do you reuse the loader at the preload stage?


clark
 Share

Recommended Posts

You may be familiar with this:

preload(){    this.load.image("preloadbg", urlToPreloadBG);        this.load.image("preloadbgbar", urlToPreloadBGBar);}

But I wondered, how would you handle a situation where the game depends on JSON in order to further load data? 

So for example
 

preload(){        var that = this;    this.load.onLoadComplete.addOnce( function(){         //great, I have config, and I parsed it, and now I need to load a language file and do not want to start just yet         that.load.onLoadComplete.addOnce(function(){               console.log("TADA, now continue");         });         that.load.json("en", urlToEn);                   });    this.load.image("preloadbg", urlToPreloadBG);        this.load.image("preloadbgbar", urlToPreloadBGBar);    this.load.json("config", urlToConfig);}

I messed around with the reset() and also tried onFileComplete and so on but not having much luck after the initial preloadbg/preloadbgbar/config is loaded.



 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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