add client side physics

by god did this take a lot of debugging to get working
This commit is contained in:
Asraelite 2016-03-24 00:13:10 +00:00
parent 65f78ec3ac
commit 1412cabbb4
19 changed files with 697 additions and 71 deletions

View file

@ -16,12 +16,11 @@ function Net() {
this.socket.on('update', function(data) {
game.world.update(data);
window.q = data;
//console.log('.');
});
this.socket.on('world', function(data) {
game.world.clear();
console.log(data);
game.world.playerShipId = data.playerShipId;
for (var i in data.bodies) {
game.world.add(data.bodies[i]);
@ -31,6 +30,10 @@ function Net() {
this.socket.on('create', function(data) {
game.world.add(data);
});
this.socket.on('destroy', function(data) {
game.world.remove(data);
});
};
this.update = function(move) {