image(key, url, overwrite) → {Phaser.Loader}
Adds an Image to the current load queue.
The file is not loaded immediately after calling this method. The file is added to the queue ready to be loaded when the loader starts.
Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle.
The key must be a unique String. It is used to add the file to the Phaser.Cache upon successful load.
Retrieve the image via Cache.getImage(key)
The URL can be relative or absolute. If the URL is relative the Loader.baseURL
and Loader.path
values will be prepended to it.
If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien"
and no URL is given then the Loader will set the URL to be "alien.png". It will always add .png
as the extension.
If you do not desire this action then provide a URL.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
key | string | Unique asset key of this image file. | ||
url | string | <optional> | URL of an image file. If undefined or | |
overwrite | boolean | <optional> | false | If an unloaded file with a matching key already exists in the queue, this entry will overwrite it. |
Returns
This Loader instance.
- Source code: loader/Loader.js (Line 693)
Please login to continue.