added kill on border

This commit is contained in:
unknown 2015-07-07 03:20:57 -04:00
parent 2fa13fc69b
commit ec59251435

View File

@ -78,9 +78,6 @@ function serverTransfer(coordinate,team,turn) {
); );
} }
// Creation of Table // Creation of Table
function tableCreate() { function tableCreate() {
@ -98,8 +95,6 @@ function tableCreate() {
table = document.getElementsByTagName('table')[0]; table = document.getElementsByTagName('table')[0];
} }
// Creation of Player // Creation of Player
function createPlayer() { function createPlayer() {
@ -107,12 +102,12 @@ function createPlayer() {
table.rows[coordinate[0]].cells[coordinate[1]].className = "player "; table.rows[coordinate[0]].cells[coordinate[1]].className = "player ";
} }
function movement(x,y) { function movement(x,y) {
timer = timer =
setTimeout(function() { setTimeout(function() {
try { try {
if (table.rows[coordinate[0] + y].cells[coordinate[1] + x].className.includes(team)) { 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; table.rows[coordinate[0]].cells[coordinate[1]].style.backgroundColor = claimColor;
document.getElementsByClassName('player')[0].className = ""; document.getElementsByClassName('player')[0].className = "";
spectatorMode(); spectatorMode();
@ -131,6 +126,10 @@ function movement(x,y) {
} }
} }
catch(err) { catch(err) {
//Kills Player
table.rows[coordinate[0]].cells[coordinate[1]].style.backgroundColor = claimColor;
document.getElementsByClassName('player')[0].className = "";
spectatorMode();
} }
}, 100); }, 100);
} }