improve multiplayer
This commit is contained in:
parent
0aa259b874
commit
2fffe574c1
10 changed files with 76 additions and 19 deletions
|
@ -25,12 +25,16 @@ class Player {
|
|||
});
|
||||
}
|
||||
|
||||
send(msg, data) {
|
||||
this.connection.send(msg, data);
|
||||
}
|
||||
|
||||
sendWorld(data) {
|
||||
this.connection.send('world', data);
|
||||
}
|
||||
|
||||
sendUpdate() {
|
||||
if (Object.keys(this.delta).length == 0) return;
|
||||
if (Object.keys(this.delta).length == 0 || Math.random() < 0) return;
|
||||
this.connection.send('update', this.delta);
|
||||
this.delta = {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue