Christmas animations are preloaded now

This commit is contained in:
Mal 2024-12-21 16:51:31 +01:00
parent b70d327f89
commit ae0c61282b

View File

@ -34,6 +34,7 @@ function mainLoop(timestamp)
if (game.KeyLoad.isPressed()) { if (game.KeyLoad.isPressed()) {
const dialog = new LoadLevelDialog(); const dialog = new LoadLevelDialog();
dialog.onClose = () => { dialog.onClose = () => {
dialog.close(); dialog.close();
game.isPaused = false; game.isPaused = false;
@ -41,6 +42,11 @@ function mainLoop(timestamp)
} }
dialog.onLoad = (data) => { dialog.onLoad = (data) => {
EventBus.clear(); EventBus.clear();
for (const effect of game.level.fullscreenEffects) {
effect.destroy();
}
loadLevel(Level.createFromJson(data)); loadLevel(Level.createFromJson(data));
} }
@ -55,6 +61,8 @@ function loadLevel(level)
const loader = new ImageLoader(); const loader = new ImageLoader();
loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right.png'); 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-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-right.png');
loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');
loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');