From ae0c61282b611a3a079ff9b6c6efb1df24b1407a Mon Sep 17 00:00:00 2001 From: Mal Date: Sat, 21 Dec 2024 16:51:31 +0100 Subject: [PATCH] Christmas animations are preloaded now --- js/module.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/module.js b/js/module.js index a081469..2b5fb4f 100644 --- a/js/module.js +++ b/js/module.js @@ -34,13 +34,19 @@ function mainLoop(timestamp) if (game.KeyLoad.isPressed()) { const dialog = new LoadLevelDialog(); - dialog.onClose = () => { + + dialog.onClose = () => { dialog.close(); game.isPaused = false; window.requestAnimationFrame(mainLoop); } dialog.onLoad = (data) => { EventBus.clear(); + + for (const effect of game.level.fullscreenEffects) { + effect.destroy(); + } + loadLevel(Level.createFromJson(data)); } @@ -55,6 +61,8 @@ function loadLevel(level) const loader = new ImageLoader(); loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-left.png'); + loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right-christmas.png'); + loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-left-christmas.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-right.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');