add basic ship movement and tracking

This commit is contained in:
Asraelite 2016-03-22 11:56:53 +00:00
parent fcfe1e8790
commit 05ad81ed8d
10 changed files with 65 additions and 27 deletions

View file

@ -1,12 +1,14 @@
function World() {
this.bodies = {};
this.playerShip = false;
this.playerShipId = false;
this.update = function(data) {
this.playerShip = this.bodies[this.playerShipId];
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];
@ -14,7 +16,7 @@ function World() {
body.y = data[id][1];
body.r = data[id][2];
}
}
}