add basic updating to client on physics
This commit is contained in:
parent
95e0f6b710
commit
1027d980c1
15 changed files with 160 additions and 13 deletions
|
@ -9,7 +9,18 @@ class Player {
|
|||
this.team = false;
|
||||
this.kickCount = 0;
|
||||
this.connection = connection;
|
||||
this.name = `Stupid $(fruit[Math.random() * fruit.length | 0])`;
|
||||
this.name = `Stupid ${fruit[Math.random() * fruit.length | 0]}`;
|
||||
this.delta = {};
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.room.remove(this);
|
||||
}
|
||||
|
||||
sendUpdate() {
|
||||
if (Object.keys(this.delta).length == 0) return;
|
||||
this.connection.send('update', this.delta);
|
||||
this.delta = {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue