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

@ -2,7 +2,7 @@ function Net() {
this.socket;
this.connect = function() {
this.socket = io.connect('http://localhost:8080');
this.socket = io.connect('/');
this.socket.on('connect', function() {
game.connected = true;
@ -27,6 +27,10 @@ function Net() {
game.world.add(data.bodies[i]);
}
});
this.socket.on('create', function(data) {
game.world.add(data);
});
};
this.update = function(move) {