minor edits of previous commits
This commit is contained in:
parent
ca249361b6
commit
d9be46986e
@ -65,11 +65,11 @@ function serverTransfer(coordinate,team,turn,username) {
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
contentType: 'application/json;charset=UTF-8'
|
contentType: 'application/json;charset=UTF-8'
|
||||||
})
|
})
|
||||||
// Receiving Data
|
// Server Response
|
||||||
.then(
|
.then(
|
||||||
function success(data) {
|
function success(data) {
|
||||||
for (var user in data) {
|
for (var user in data) {
|
||||||
} if (data.hasOwnProperty(user) && (user != username)) {
|
if (data.hasOwnProperty(user) && (user != username)) {
|
||||||
console.log(data[user][turn]);
|
console.log(data[user][turn]);
|
||||||
var theMove = data[user][turn];
|
var theMove = data[user][turn];
|
||||||
updateTable(theMove[1], theMove[2]);
|
updateTable(theMove[1], theMove[2]);
|
||||||
@ -163,7 +163,7 @@ function movement(x,y) {
|
|||||||
timer =
|
timer =
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
try {
|
try {
|
||||||
if(nextSquare.className.includes(playerTeam) || nextSquare.className.includes('player')) {
|
if (nextSquare.className.includes(playerTeam) || nextSquare.className.includes('player')) {
|
||||||
killPlayer(playerCoordinate, playerTeam);
|
killPlayer(playerCoordinate, playerTeam);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -195,22 +195,19 @@ function movePlayer(e) {
|
|||||||
|
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
if(e.keyCode === 38 && type != "up") {
|
if (e.keyCode === 38 && type != "up") {
|
||||||
type = "up";
|
type = "up";
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
movement(0,-1);
|
movement(0,-1);
|
||||||
} else
|
} else if (e.keyCode === 40 && type != "down") {
|
||||||
if(e.keyCode === 40 && type != "down") {
|
|
||||||
type = "down";
|
type = "down";
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
movement(0,1);
|
movement(0,1);
|
||||||
} else
|
} else if (e.keyCode === 37 && type != "left") {
|
||||||
if(e.keyCode === 37 && type != "left") {
|
|
||||||
type = "left"
|
type = "left"
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
movement(-1,0);
|
movement(-1,0);
|
||||||
} else
|
} else if (e.keyCode === 39 && type != "right") {
|
||||||
if(e.keyCode === 39 && type != "right") {
|
|
||||||
type = "right"
|
type = "right"
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
movement(1,0);
|
movement(1,0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user