This commit is contained in:
Killian Marty 2023-12-06 09:44:05 +01:00
parent b586b161a1
commit f0483bbff8

View file

@ -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;
} }
} }