Giesela is now sleeping until finish
This commit is contained in:
parent
607cdb1798
commit
179eaf4f82
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
24
js/Game.js
24
js/Game.js
|
@ -51,10 +51,20 @@ export class Game
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.gisela.currentAnimation !== 'LOOK_LEFT' && this.mrCroc.position.x < this.gisela.position.x) {
|
/*
|
||||||
this.gisela.currentAnimation = 'LOOK_LEFT';
|
if (this.gisela.currentAnimation !== 'SLEEP_LEFT' && this.mrCroc.position.x < this.gisela.position.x) {
|
||||||
} else if (this.gisela.currentAnimation !== 'LOOK_RIGHT' && this.mrCroc.position.x >= this.gisela.position.x) {
|
this.gisela.currentAnimation = 'SLEEP_LEFT';
|
||||||
this.gisela.currentAnimation = 'LOOK_RIGHT';
|
} else if (this.gisela.currentAnimation !== 'SLEEP_RIGHT' && this.mrCroc.position.x >= this.gisela.position.x) {
|
||||||
|
this.gisela.currentAnimation = 'SLEEP_RIGHT';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!this.gameFinished) {
|
||||||
|
if (this.mrCroc.position.x < this.gisela.position.x) {
|
||||||
|
this.gisela.playAnimation('SLEEP_LEFT', timestamp);
|
||||||
|
} else {
|
||||||
|
this.gisela.playAnimation('SLEEP_RIGHT', timestamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.context.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
this.context.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
||||||
|
@ -164,6 +174,12 @@ export class Game
|
||||||
|
|
||||||
finish()
|
finish()
|
||||||
{
|
{
|
||||||
|
if (this.mrCroc.position.x < this.gisela.position.x) {
|
||||||
|
this.gisela.currentAnimation = 'LOOK_LEFT';
|
||||||
|
} else {
|
||||||
|
this.gisela.currentAnimation = 'LOOK_RIGHT';
|
||||||
|
}
|
||||||
|
|
||||||
this.gameFinished = true;
|
this.gameFinished = true;
|
||||||
this.KeyLeft.pressed = false;
|
this.KeyLeft.pressed = false;
|
||||||
this.KeyRight.pressed = false;
|
this.KeyRight.pressed = false;
|
||||||
|
|
10
js/Gisela.js
10
js/Gisela.js
|
@ -15,5 +15,13 @@ export default class Gisela extends Movable
|
||||||
'LOOK_RIGHT',
|
'LOOK_RIGHT',
|
||||||
new RetroAnimation(Setting.GRAPHICS_LOCATION + 'gisela-right.png', 1, SCALE, 0.01)
|
new RetroAnimation(Setting.GRAPHICS_LOCATION + 'gisela-right.png', 1, SCALE, 0.01)
|
||||||
);
|
);
|
||||||
|
this.addAnimation(
|
||||||
|
'SLEEP_LEFT',
|
||||||
|
new RetroAnimation(Setting.GRAPHICS_LOCATION + 'giesela-left-sleeping.png', 4, SCALE, 4)
|
||||||
|
);
|
||||||
|
this.addAnimation(
|
||||||
|
'SLEEP_RIGHT',
|
||||||
|
new RetroAnimation(Setting.GRAPHICS_LOCATION + 'giesela-right-sleeping.png', 4, SCALE, 4)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ function loadLevel(level)
|
||||||
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');
|
||||||
|
loader.addImage(Setting.GRAPHICS_LOCATION + 'giesela-left-sleeping.png');
|
||||||
|
loader.addImage(Setting.GRAPHICS_LOCATION + 'giesela-right-sleeping.png');
|
||||||
|
|
||||||
for (const graphicSet of GraphicSet) {
|
for (const graphicSet of GraphicSet) {
|
||||||
loader.addImage(Setting.TILESET_LOCATION + graphicSet.tileset);
|
loader.addImage(Setting.TILESET_LOCATION + graphicSet.tileset);
|
||||||
|
|
Loading…
Reference in New Issue