srv
This commit is contained in:
parent
b586b161a1
commit
f0483bbff8
1 changed files with 1 additions and 2 deletions
|
@ -55,12 +55,12 @@ function generatePosition(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//return x, y;
|
//return x, y;
|
||||||
|
console.log(x, y);
|
||||||
return [500, 100];
|
return [500, 100];
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewPlayer(socket, name){
|
function createNewPlayer(socket, name){
|
||||||
let pos = generatePosition();
|
let pos = generatePosition();
|
||||||
console.log(pos)
|
|
||||||
var obj = {
|
var obj = {
|
||||||
id: playerCount,
|
id: playerCount,
|
||||||
x: pos[0],
|
x: pos[0],
|
||||||
|
@ -104,7 +104,6 @@ wss.on('connection', (socket, req) => {
|
||||||
} else if(message.type=="update") {
|
} else if(message.type=="update") {
|
||||||
for (var i = players.length - 1; i >= 0; i--) {
|
for (var i = players.length - 1; i >= 0; i--) {
|
||||||
if(players[i].id == message.data.id){
|
if(players[i].id == message.data.id){
|
||||||
console.log(players[i].id);
|
|
||||||
players[i]=message.data;
|
players[i]=message.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue