Separate sprites into their own files

This commit is contained in:
2026-02-25 15:33:00 -03:00
parent 8867e36489
commit 36fc3869a2
54 changed files with 143 additions and 16 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
type Asset = HTMLImageElement | HTMLAudioElement | string;
type Asset = HTMLImageElement | HTMLAudioElement | string | Record<string, unknown>;
export class AssetManager {
static instance = new AssetManager();
@@ -47,6 +47,12 @@ export class AssetManager {
this.assets[key] = await resp.text();
};
this.loading_promises.push(promise());
} else if (src.endsWith(".json")) {
const promise = async () => {
const resp = await fetch(src);
this.assets[key] = await resp.json();
};
this.loading_promises.push(promise());
}
}