improve multiplayer
This commit is contained in:
parent
0aa259b874
commit
2fffe574c1
10 changed files with 76 additions and 19 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue