improve multiplayer

This commit is contained in:
Asraelite 2016-03-22 19:20:50 +00:00
parent 0aa259b874
commit 2fffe574c1
10 changed files with 76 additions and 19 deletions

View file

@ -7,7 +7,7 @@ class Room {
this.players = new Set();
this.teamA = new Set();
this.teamB = new Set();
this.world = new World();
this.world = new World(this);
this.name = (Math.random() * 100000 | 0).toString(36);
this.start();
@ -42,6 +42,10 @@ class Room {
self.players.forEach(player => player.sendUpdate());
}
broadcast(msg, data) {
this.players.forEach(player => player.send(msg, data));
}
sendWorld(player) {
let data = {
playerShipId: player.ship.id,