From 25adfc618e77db9a5ee3b98ce0dab0be832efed0 Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Tue, 24 Dec 2024 17:58:20 +0100 Subject: hello kitty base done --- preloader.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 preloader.js (limited to 'preloader.js') diff --git a/preloader.js b/preloader.js new file mode 100644 index 0000000..214421e --- /dev/null +++ b/preloader.js @@ -0,0 +1,20 @@ +import * as ASSETS from "./src/assets.js" + +function preload(a) { + var tempImg = new Image() + tempImg.src=a +} + +function preloadAudio(a) { + var tempAud = new Audio(a) + tempAud.load() +} + +export function preloadAll() { +ASSETS.PORTAL.map(preload) +Array.from([ASSETS.BOSHY.BULLET, ASSETS.BOSHY.NORMAL]).map(preload) +Array.from([ASSETS.MUSIC.PREQUEL, ASSETS.MUSIC.HELL, ASSETS.MUSIC.DEATH]).map(preloadAudio) +Array.from([ASSETS.BACKGROUND.DEFAULT, ASSETS.BACKGROUND.DARK_SUN]).map(preload) +} + +preloadAll() -- cgit v1.2.3