diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2014-09-02 07:29:19 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2014-09-02 07:29:19 +0200 |
commit | 0afb9206527dfae6793e5e569bd9084018048844 (patch) | |
tree | 5130b1365c709b0be7c31a8574c030c99788493c /game/states/play.js | |
parent | 4b108a35a580d4805553ad7d3075e9fb4ec0f48b (diff) |
Handled players both eating poison together
Diffstat (limited to 'game/states/play.js')
-rw-r--r-- | game/states/play.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/game/states/play.js b/game/states/play.js index c81d978..37dabb4 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -29,7 +29,8 @@ Play.prototype = { this.checkForPlayerPillCollisions(); this.checkForPlayerPoisonPillCollisions(); - if (Phaser.Rectangle.intersects(this.playerA.getBounds(), this.playerB.getBounds())) { + if (this.playerA.canBeEaten && this.playerB.canBeEayen && + Phaser.Rectangle.intersects(this.playerA.getBounds(), this.playerB.getBounds())) { this.playerPlayerCollision(this.playerA, this.playerB); } @@ -372,6 +373,7 @@ Play.prototype = { else { eatenPlayer.teleport(this.respawnX, this.respawnY); } + eatenPlayer.canBeEaten = false; eatenPlayer.respawnSound.play(); }, togglePlayerTurn: function() { @@ -381,6 +383,7 @@ Play.prototype = { this.playerTurn = newPlayerTurn; for (var i=0; i<this.players.children.length; ++i) { this.players.children[i].isMyTurn = (i === this.playerTurn); + this.players.children[i].canBeEaten = true; } }, setVictoryText: function(newText, winnerLetter) { |