Crafty.paths()

public void Crafty.paths([Object paths])
paths

Object containing paths for audio and images folders

Function to define custom folder for audio and images. You should use this function to avoid typing the same paths again and again when loading assets with the Crafty.load() function.

If you do not give a object you get the current paths for both audio and images back.

You do not have to define paths.

Example

Setting folders:

Crafty.paths({ audio: "custom/audio/path/", images: "custom/images/path/" });

Crafty.load({
  "audio": {
    "ray": ['ray.mp3'] // This loads ray.mp3 from custom/audio/path/ray.mp3
  }
}, function() {
  Crafty.log('loaded');
});

See Also