Jump to content

Load assets asynchronously on the run


soylomass
 Share

Recommended Posts

Hi, is it possible to load assets on the run, and show them on a sprite when they are loaded?

I'm developing a team feature, where a team (and it's logo) may have been created after the game was loaded (therefore I can't load it's texture on preload).

I've seen other canvas games which do that, for example Agar.io (http://agar.io/). You can check the chrome console, Network tab, filter by Img, and you'll see the images are loaded as a player using them appears on screen. This is all seamless.

Is it possible to do with Phaser?

 

Thanks in advance.

Link to comment
Share on other sites

The standard loader can be used as many times as you want (I think), you'd just listen for the load events and start displaying the corresponding sprites when you hear it.

The process is the same with any browser load, request the asset, listen for the onLoad/onComplete event, respond using the loaded asset, handle failures.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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