Phaser API Documentation

  Version: 
setPath([path])

Description:

The value of path, if set, is placed before any relative file path given. For example:

this.load.setPath("images/sprites/");
this.load.image("ball", "ball.png");
this.load.image("tree", "level1/oaktree.png");
this.load.image("boom", "[http://server.com/explode.png](http://server.com/explode.png)");

Would load the ball file from images/sprites/ball.png and the tree from images/sprites/level1/oaktree.png but the file boom would load from the URL given as it's an absolute URL.

Please note that the path is added before the filename but after the baseURL (if set.)

Once a path is set it will then affect every file added to the Loader from that point on. It does not change any file already in the load queue. To reset it, call this method with no arguments.

Parameters:

name type arguments description
path string <optional>

The path to use. Leave empty to reset.

Returns:
Description:

This Loader object.

Since: 3.0.0