diff --git a/clashingcomrades/static/main.js b/clashingcomrades/static/main.js index 8a311c8..e295371 100644 --- a/clashingcomrades/static/main.js +++ b/clashingcomrades/static/main.js @@ -91,9 +91,6 @@ function serverTransfer(coordinate,team,turn,username) { ); } - - - // Creation of Table function tableCreate() { @@ -123,7 +120,6 @@ function oldTableUpdate(coordinate, team) { current.style.backgroundColor = claimedColors[team]; } - // Creation of Player function createPlayer() { @@ -131,12 +127,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 = claimedColors[team]; document.getElementsByClassName('player')[0].className = ""; spectatorMode(); @@ -155,6 +151,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); }