Compare commits

..

2 Commits

Author SHA1 Message Date
Mal
ae0c61282b Christmas animations are preloaded now 2024-12-21 16:51:31 +01:00
Mal
b70d327f89 Mr. Croc Christmas version implemented 2024-12-21 16:44:58 +01:00
4 changed files with 17 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -6,10 +6,15 @@ export default class MrCroc extends Movable
{
constructor() {
const SCALE = 2;
super(new RetroAnimation(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right.png', 2, SCALE), 7);
const month = new Date().getMonth();
const animationRight = month === 11 ? 'mr-croc-walk-right-christmas.png' : 'mr-croc-walk-right.png';
const animationLeft = month === 11 ? 'mr-croc-walk-left-christmas.png' : 'mr-croc-walk-left.png';
super(new RetroAnimation(Setting.GRAPHICS_LOCATION + animationRight, 2, SCALE), 7);
this.isJumping = false;
this.addAnimation('WALK_RIGHT', new RetroAnimation(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right.png', 2, SCALE, 10));
this.addAnimation('WALK_LEFT', new RetroAnimation(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-left.png', 2, SCALE, 10));
this.addAnimation('WALK_RIGHT', new RetroAnimation(Setting.GRAPHICS_LOCATION + animationRight, 2, SCALE, 10));
this.addAnimation('WALK_LEFT', new RetroAnimation(Setting.GRAPHICS_LOCATION + animationLeft, 2, SCALE, 10));
}
moveRight(timestamp, delta = 1)

View File

@ -34,6 +34,7 @@ function mainLoop(timestamp)
if (game.KeyLoad.isPressed()) {
const dialog = new LoadLevelDialog();
dialog.onClose = () => {
dialog.close();
game.isPaused = false;
@ -41,6 +42,11 @@ function mainLoop(timestamp)
}
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');