Hello there,
I am using the phaser3-webpack-project-template(which is great) but had a couple quick questions:
-
Since I specify imports for all my webpack data files, there seems to be no need for using the loader, instead I should just add those files directly to the global cache, is this correct?
-
I am successfully adding a json file to the cache however I cannot for the life of me seem to catch the add event. Any pointers would be appreciated I have put the relevant snippet below.
import levelData from ‘…/data/levels.json’;
preload() {
let loadFileText = this.add.text(300, 300, ‘’);
this.events.on(Phaser.Cache.Events.ADD, function (cache, key, obj) {
console.log(“Got add event”, key);
loadFileText.setText('Loaded file ’ + key);
});
this.cache.json.add(‘levelData’, levelData);
}
PS sorry for the formatting, I’m not finding a way to properly embed a code block