From 823b1021395e03787c4d42bf5fa99dff2f6d8036 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jul 2015 03:33:44 -0400 Subject: [PATCH] fixed kill on border --- clashingcomrades/static/main.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/clashingcomrades/static/main.js b/clashingcomrades/static/main.js index e04a48d..fe8e789 100644 --- a/clashingcomrades/static/main.js +++ b/clashingcomrades/static/main.js @@ -172,8 +172,13 @@ function updateScore() { function movement(x,y) { if (playerTeam != "spectator") { - previousSquare = table.rows[playerCoordinate[0]].cells[playerCoordinate[1]]; - nextSquare = table.rows[playerCoordinate[0] + y].cells[playerCoordinate[1] + x]; + try { + previousSquare = table.rows[playerCoordinate[0]].cells[playerCoordinate[1]]; + nextSquare = table.rows[playerCoordinate[0] + y].cells[playerCoordinate[1] + x]; + } catch(err) { + //Hitting top/down + killPlayer(playerCoordinate, playerTeam); + } } timer = @@ -204,7 +209,7 @@ function movement(x,y) { movement(x,y); } catch(err) { - // On hit wall + // Hitting left/right killPlayer(playerCoordinate, playerTeam); } }, 100);