Separate sprites into their own files
This commit is contained in:
+7
-1
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user