AssetsManager.js
AssetsManager
Kind: global class
- AssetsManager
- new AssetsManager()
- .load(assets) ⇒
void
- .loadSprite(name, path) ⇒
void
- .loadFont(name, path) ⇒
void
- .loadAudios(name, path) ⇒
void
- .getSprite(name) ⇒
Object
- .getFont(name) ⇒
string
- .getAudio(name) ⇒
Object
- .getSpriteSize(name) ⇒
Object
new AssetsManager()
A class to manage the assets.
AssetsManager.load(assets) ⇒ void
Load the assets
Kind: static method of AssetsManager
Param | Type | Description |
---|---|---|
assets | Object | The assets to load |
Example
load({
sprites: { MySprite: "./MySprite.png", },
fonts: { "MyFont": "MyFont.ttf", },
audios: { "MyAudio": "MyAudio.mp3", }
});
AssetsManager.loadSprite(name, path) ⇒ void
Load a sprite
Kind: static method of AssetsManager
Param | Type | Description |
---|---|---|
name | string | The name of the sprite |
path | string | The path of the sprite |
AssetsManager.loadFont(name, path) ⇒ void
Load a font
Kind: static method of AssetsManager
Param | Type | Description |
---|---|---|
name | string | The name of the font |
path | string | The path of the font |
AssetsManager.loadAudios(name, path) ⇒ void
Load a sound
Kind: static method of AssetsManager
Param | Type | Description |
---|---|---|
name | string | The name of the sound |
path | string | The path of the sound |
AssetsManager.getSprite(name) ⇒ Object
Return the sprite based on the name
Kind: static method of AssetsManager
Returns: Object
-
The sprite
Param | Type | Description |
---|---|---|
name | string | The name of the sprite |
AssetsManager.getFont(name) ⇒ string
Return the font based on the name
Kind: static method of AssetsManager
Returns: string
-
The font
Param | Type | Description |
---|---|---|
name | string | The name of the font |
AssetsManager.getAudio(name) ⇒ Object
Return the audio based on the name
Kind: static method of AssetsManager
Returns: Object
-
The audio
Param | Type | Description |
---|---|---|
name | string | The name of the audio |
AssetsManager.getSpriteSize(name) ⇒ Object
Return the size of the sprite
Kind: static method of AssetsManager
Returns: Object
-
The size of the sprite
Param | Type | Description |
---|---|---|
name | string | The name of the sprite |