diff options
Diffstat (limited to 'preloader.js')
-rw-r--r-- | preloader.js | 20 |
1 files changed, 20 insertions, 0 deletions
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() |