add basic ship movement and tracking
This commit is contained in:
parent
fcfe1e8790
commit
05ad81ed8d
10 changed files with 65 additions and 27 deletions
|
@ -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];
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue