mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Giesela is now sleeping until finish
This commit is contained in:
24
js/Game.js
24
js/Game.js
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user