When preloading your scene, use P2P.load() by passing in the folder generated by PSDtoJSON. Any assets in the JSON that do not have a lazyLoad:true
attribute will start loading. Events are emitted as each asset is loaded.
// Load the JSON
this.P2P.load(this, "psd_key", "assets/simple");
// Load with lazyLoad options - set all layers to lazy load
this.P2P.load(this, "psd_key", "assets/simple", {
lazyLoad: true
});
// Load with lazyLoad options - set specific layers to lazy load
this.P2P.load(this, "psd_key", "assets/simple", {
lazyLoad: ["background", "monster"]
});
// Listen for asset loading progress
this.events.on("psdLoadProgress", (value) => {
this.P2PProgress = value;
this.updateProgress();
});
// Listen for asset loading completion
this.events.once(
"psdLoadComplete",
() => {
console.log("All done!");
},
this
);