add asteroids

This commit is contained in:
Asraelite 2016-03-22 18:34:11 +00:00
parent 0ceea5f4af
commit 0aa259b874
17 changed files with 246 additions and 37 deletions

View file

@ -16,11 +16,16 @@ function Net() {
this.socket.on('update', function(data) {
game.world.update(data);
window.q = data;
});
this.socket.on('world', function(data) {
game.world.clear();
game.world.playerShipId = data;
console.log(data);
game.world.playerShipId = data.playerShipId;
for (var i in data.bodies) {
game.world.add(data.bodies[i]);
}
});
};
@ -31,4 +36,8 @@ function Net() {
right: move[2]
});
}
this.send = function(msg, data) {
this.socket.emit(msg, data);
}
}