summaryrefslogtreecommitdiff
path: root/engine/config/assets.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-12 13:49:16 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-12 13:49:16 -0600
commitc6e9baa0009f7cce0f6ff156a3957ef04a8cb684 (patch)
tree9766a4a33ad1c86aa71a5f92daf8917f3e5f5eed /engine/config/assets.ts
parentb67ffb57c1bf6e9628339a3f43c71ccebdb46136 (diff)
downloadjumpstorm-c6e9baa0009f7cce0f6ff156a3957ef04a8cb684.tar.gz
jumpstorm-c6e9baa0009f7cce0f6ff156a3957ef04a8cb684.zip
the great engine refactor
Diffstat (limited to 'engine/config/assets.ts')
-rw-r--r--engine/config/assets.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/engine/config/assets.ts b/engine/config/assets.ts
index 51a5303..173bab3 100644
--- a/engine/config/assets.ts
+++ b/engine/config/assets.ts
@@ -4,7 +4,7 @@ import { SPRITE_SPECS } from "./sprites";
export const IMAGES = new Map<string, HTMLImageElement>();
export const loadSpritesIntoImageElements = (
- spriteSpecs: Partial<SpriteSpec>[]
+ spriteSpecs: Partial<SpriteSpec>[],
): Promise<void>[] => {
const spritePromises: Promise<void>[] = [];
@@ -17,13 +17,13 @@ export const loadSpritesIntoImageElements = (
spritePromises.push(
new Promise((resolve) => {
img.onload = () => resolve();
- })
+ }),
);
}
if (spriteSpec.states) {
spritePromises.push(
- ...loadSpritesIntoImageElements(Object.values(spriteSpec.states))
+ ...loadSpritesIntoImageElements(Array.from(spriteSpec.states.values())),
);
}
}
@@ -34,7 +34,9 @@ export const loadSpritesIntoImageElements = (
export const loadAssets = () =>
Promise.all([
...loadSpritesIntoImageElements(
- Array.from(SPRITE_SPECS.keys()).map((key) => SPRITE_SPECS.get(key))
+ Array.from(SPRITE_SPECS.keys()).map(
+ (key) => SPRITE_SPECS.get(key) as SpriteSpec,
+ ),
),
// TODO: Sound
]);