From 4b108a35a580d4805553ad7d3075e9fb4ec0f48b Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Mon, 1 Sep 2014 08:11:57 +0200 Subject: Prevented eating opponent when leaving respawn spot --- game/states/play.js | 20 ++++++++++++++++---- todo.md | 3 +-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/game/states/play.js b/game/states/play.js index 617176d..c81d978 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -275,14 +275,26 @@ Play.prototype = { var newX = player.x + deltaX; var newY = player.y + deltaY; var placePoisonPill = player.hasPoisonPill && player.poisonPillActive; + + //cannot move into walls, when it isn't your turn, or when you're already moving if (this.checkMap(newX, newY) || !player.isMyTurn || player.moving) { return; } - if (Math.abs(newX-this.respawnX)<=1 && Math.abs(newY-this.respawnY)<=1 && ( - Math.abs(newX-this.respawnX)