add non-functioning explosions

I'm tired and box2d ray casting is stupid so this'll have to do for today
This commit is contained in:
Asraelite 2016-03-25 00:54:15 +00:00
parent ac089f3e8e
commit bf8226481d
7 changed files with 68 additions and 5 deletions

View file

@ -22,13 +22,17 @@ class Body {
applyForce(x, y, center) {
let b = this.b2body;
b.ApplyForce(new b2Vec2(x, y), b.GetWorldCenter());
let c = center ? new b2Vec2(center.x, center.y) : b.GetWorldCenter();
b.ApplyForce(new b2Vec2(x, y), c);
}
applyTorque(f) {
this.b2body.ApplyTorque(f);
}
contact() {
}
tick() {
let pos = this.b2body.GetPosition();
let bounds = this.world.bounds;
@ -74,6 +78,13 @@ class Body {
r: this.b2body.GetAngleRadians()
};
}
get vel() {
return {
xvel: this.b2body.GetLinearVelocity().x,
yvel: this.b2body.GetLinearVelocity().y
}
}
}
module.exports = Body;