add asteroids

This commit is contained in:
Asraelite 2016-03-22 18:34:11 +00:00
parent 0ceea5f4af
commit 0aa259b874
17 changed files with 246 additions and 37 deletions

View file

@ -1,8 +1,11 @@
function Ship(id) {
this.id = id;
this.x = 0;
this.y = 0;
this.r = 0;
function Ship(data) {
this.id = data.id;
this.x = data.delta[0];
this.y = data.delta[1];
this.r = data.delta[4];
this.xvel = data.delta[2];
this.yvel = data.delta[3];
this.rvel = data.delta[5];
this.hull = '01';
this.move = [];
this.lastMove = [];
@ -21,6 +24,14 @@ function Ship(id) {
}
}
this.update = function (data) {
this.x = data[0];
this.y = data[1];
this.xvel = data[2];
this.yvel = data[3];
this.r = data[4];
}
this.updateMove = function() {
if (JSON.stringify(this.move) != JSON.stringify(this.lastMove) || true) {
game.net.update(this.move);