Preloads all asset files used in the game
- Images
- Sounds
- JSON
Broadcasts events during the process so that other classes can keep track:
assetsloadupdate
- A single item has just loaded, including a percentage of items loaded so farassetsloaded
- All items have finished loading
- License
- GPL-3.0-only
- Source
Methods
(static) init()
- Source
Initialise the preloader
- Add all objects to be preloaded
- Calculate totals
- Set up event listener for items loading
(static) onComplete()
- Source
Everything has finished preloading
Broadcast an assetsloaded
event.
(static) onItemDone(event)
- Source
An item has finished loading
- Update count of total items loaded
- Calculate count as a percentage (based on number of items ie size is not considered)
- Broadcast the details in an
assetsloadupdate
event to be used eg byLoadingIndicator
- Call
onComplete()
when all done
Parameters
Name | Type | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
Event |
|