Skip to content

Commit

Permalink
End game on death of all players
Browse files Browse the repository at this point in the history
Aslo, display actual score again
  • Loading branch information
Eric L. Solis committed Nov 26, 2020
1 parent b12e4d3 commit 767c0a0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/scenes/game/GameScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ class GameScene extends Phaser.Scene {
*/
onPlayerHitObstacle(id) {
this.players[id].die(this.score);
// this.players.splice(id, 1);
// console.log(id);
// this.events.emit(CONFIG.EVENTS.GAME_OVER, this.score, this.highScore, id);
if (this.players.every(player => player.isDead))
this.events.emit(CONFIG.EVENTS.GAME_OVER, this.score, this.highScore, id);
}

/**
Expand Down Expand Up @@ -259,8 +258,7 @@ class GameScene extends Phaser.Scene {
* @returns {number} - Current score
*/
get score() {
return this._score;
// return Math.ceil(this.distance * GameScene.CONFIG.GAME.SCORE.COEFFICIENT);
return Math.ceil(this.distance * GameScene.CONFIG.GAME.SCORE.COEFFICIENT);
}

/**
Expand Down

0 comments on commit 767c0a0

Please sign in to comment.