add basic updating to client on physics

This commit is contained in:
Asraelite 2016-03-21 23:45:27 +00:00
parent 95e0f6b710
commit 1027d980c1
15 changed files with 160 additions and 13 deletions

View file

@ -0,0 +1,5 @@
function Ship(id) {
this.id = id;
this.x = 0;
this.y = 0;
}

View file

@ -0,0 +1,20 @@
function World() {
this.bodies = {};
this.playerShip = false;
this.update = function(data) {
for (var id in data) {
if (!this.bodies[id]) {
this.bodies[id] = new Ship(id);
this.playerShip = this.bodies[id];
}
var body = this.bodies[id];
body.x = data[id][0];
body.y = data[id][1];
body.r = data[id][2];
}
}
}