Fix lag; Camille forgot usleep(500)
This commit is contained in:
parent
c6990ebb3e
commit
0d69a63b62
@ -73,13 +73,10 @@ class Game
|
|||||||
if (this._socket === undefined)
|
if (this._socket === undefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const loop_id = setInterval(() => {
|
if (this._socket.readyState === WebSocket.OPEN)
|
||||||
if (this._socket.readyState === WebSocket.OPEN)
|
{
|
||||||
{
|
this._socket.send(JSON.stringify(data));
|
||||||
this._socket.send(JSON.stringify(data));
|
}
|
||||||
clearInterval(loop_id);
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_send_paddle_position(position, time)
|
_send_paddle_position(position, time)
|
||||||
@ -208,4 +205,4 @@ class Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Game }
|
export { Game }
|
||||||
|
Loading…
Reference in New Issue
Block a user