change syncing
This commit is contained in:
parent
2e524c5c8c
commit
49ef29171a
2 changed files with 3 additions and 2 deletions
2
game.js
2
game.js
|
@ -203,7 +203,7 @@ class Game extends GameBasic {
|
||||||
that.entities.push(new NPC(false, that))
|
that.entities.push(new NPC(false, that))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 103; i++) {
|
||||||
that.entities.push(new Shooter(false, that))
|
that.entities.push(new Shooter(false, that))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,12 +281,13 @@ class Game extends GameBasic {
|
||||||
|
|
||||||
this.ws = new WebSocket(origin);
|
this.ws = new WebSocket(origin);
|
||||||
|
|
||||||
|
setInterval(function () { that.sync() }, 1000 / 15);
|
||||||
|
|
||||||
this.opener = function (that) {
|
this.opener = function (that) {
|
||||||
that.sync(true);
|
that.sync(true);
|
||||||
if (tok) {
|
if (tok) {
|
||||||
that.ws.send(JSON.stringify(["AUTH", tok]));
|
that.ws.send(JSON.stringify(["AUTH", tok]));
|
||||||
}
|
}
|
||||||
setInterval(function () { that.sync() }, 1000 / 5);
|
|
||||||
|
|
||||||
that.ws.addEventListener('message', function (e) { that.recv(e) });
|
that.ws.addEventListener('message', function (e) { that.recv(e) });
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue