diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/states/play.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/game/states/play.js b/game/states/play.js index e05a65f..49c6cca 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -46,6 +46,20 @@ Play.prototype = { }, update: function() { this.game.physics.arcade.overlap(this.players, this.pills, this.playerPillCollision, null, this); + + if (this.pills.total === 0) { + + if (this.playerA.score > this.playerB.score) { + console.log("PLAYER A WINS!"); + } + else if (this.playerA.score < this.playerB.score) { + console.log("PLAYER B WINS!"); + } + else { + console.log("THIS GAME WAS A DRAW!") + } + this.game.state.start('play'); + } }, createWalls: function() { this.walls = this.game.add.group(); |