add start of gun support
This commit is contained in:
parent
444533ce85
commit
65f78ec3ac
19 changed files with 141 additions and 29 deletions
|
@ -29,6 +29,16 @@ class Body {
|
|||
this.b2body.ApplyTorque(f);
|
||||
}
|
||||
|
||||
tick() {
|
||||
let pos = this.b2body.GetPosition();
|
||||
let bounds = this.world.bounds;
|
||||
|
||||
if(pos.x < bounds.left) this.applyForce(0.003, 0);
|
||||
if(pos.x > bounds.right) this.applyForce(-0.003, 0);
|
||||
if(pos.y < bounds.top) this.applyForce(0, 0.003);
|
||||
if(pos.y > bounds.bottom) this.applyForce(-0, -0.003);
|
||||
}
|
||||
|
||||
packDelta() {
|
||||
let pos = this.b2body.GetPosition();
|
||||
let vel = this.b2body.GetLinearVelocity();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue