clean client code

This commit is contained in:
Asraelite 2016-03-24 13:26:35 +00:00
parent f3619ba891
commit 21a30ad212
18 changed files with 294 additions and 268 deletions

View file

@ -1,36 +1,10 @@
function Asteroid(data) {
this.id = data.id;
this.x = data.delta[0];
this.y = data.delta[1];
this.r = data.delta[2];
this.bodyType = 'asteroid';
this.frame = data.frame;
this.updated = false;
class Asteroid extends Body {
constructor(data) {
super(data)
this.bodyType = 'asteroid';
}
var b2Vec2 = Box2D.Common.Math.b2Vec2;
var s = SCALE;
tick() {
this.getPos = function() {
var pos = this.b2body.GetPosition();
var angle = this.b2body.GetAngle();
return {
x: pos.x,
y: pos.y,
r: angle
};
};
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.rvel = data[5];
this.updated = 10;
};
this.tick = function() {
};
}
}