Giesela is now sleeping until finish

This commit is contained in:
Mal
2024-09-03 23:08:08 +02:00
parent 607cdb1798
commit 179eaf4f82
5 changed files with 31 additions and 5 deletions

View File

@@ -51,10 +51,20 @@ export class Game
return;
}
if (this.gisela.currentAnimation !== 'LOOK_LEFT' && this.mrCroc.position.x < this.gisela.position.x) {
this.gisela.currentAnimation = 'LOOK_LEFT';
} else if (this.gisela.currentAnimation !== 'LOOK_RIGHT' && this.mrCroc.position.x >= this.gisela.position.x) {
this.gisela.currentAnimation = 'LOOK_RIGHT';
/*
if (this.gisela.currentAnimation !== 'SLEEP_LEFT' && this.mrCroc.position.x < this.gisela.position.x) {
this.gisela.currentAnimation = 'SLEEP_LEFT';
} 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);
@@ -164,6 +174,12 @@ export class Game
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.KeyLeft.pressed = false;
this.KeyRight.pressed = false;