add asteroids
This commit is contained in:
parent
0ceea5f4af
commit
0aa259b874
17 changed files with 246 additions and 37 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue