From ec592514351f3bdaee4923f71dd9103cff1586b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jul 2015 03:20:57 -0400 Subject: [PATCH] added kill on border --- clashingcomrades/static/main.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/clashingcomrades/static/main.js b/clashingcomrades/static/main.js index 3009ca4..708de9b 100644 --- a/clashingcomrades/static/main.js +++ b/clashingcomrades/static/main.js @@ -78,9 +78,6 @@ function serverTransfer(coordinate,team,turn) { ); } - - - // Creation of Table function tableCreate() { @@ -98,8 +95,6 @@ function tableCreate() { table = document.getElementsByTagName('table')[0]; } - - // Creation of Player function createPlayer() { @@ -107,12 +102,12 @@ function createPlayer() { table.rows[coordinate[0]].cells[coordinate[1]].className = "player "; } - function movement(x,y) { timer = setTimeout(function() { try { if (table.rows[coordinate[0] + y].cells[coordinate[1] + x].className.includes(team)) { + //Kills Player table.rows[coordinate[0]].cells[coordinate[1]].style.backgroundColor = claimColor; document.getElementsByClassName('player')[0].className = ""; spectatorMode(); @@ -131,6 +126,10 @@ function movement(x,y) { } } catch(err) { + //Kills Player + table.rows[coordinate[0]].cells[coordinate[1]].style.backgroundColor = claimColor; + document.getElementsByClassName('player')[0].className = ""; + spectatorMode(); } }, 100); }