loadRoot(path?: string): string

Sets the root for all subsequent resource urls. This is useful when you want to load assets from a different domain, or setup a base path for all assets.

parampath- The root path.

loadRoot("https://myassets.com/");
loadSprite("bean", "sprites/bean.png"); // will resolve to "https://myassets.com/sprites/bean.png"

loadRoot("./"); // useful for Itch.io
kaplay logo

Misc

Layer