add ship rendering and damping
This commit is contained in:
parent
05ad81ed8d
commit
80bd84230d
22 changed files with 66 additions and 6 deletions
|
@ -22,18 +22,18 @@ class Ship extends Body {
|
|||
}
|
||||
|
||||
if (data.forward) {
|
||||
let power = 0.02;
|
||||
let power = 0.05;
|
||||
let x = Math.cos(this.b2body.GetAngleRadians()) * power;
|
||||
let y = Math.sin(this.b2body.GetAngleRadians()) * power;
|
||||
this.applyForce(x, y);
|
||||
}
|
||||
|
||||
if (data.left) {
|
||||
this.applyTorque(-0.02);
|
||||
this.applyTorque(-0.0001);
|
||||
}
|
||||
|
||||
if (data.right) {
|
||||
this.applyTorque(0.02);
|
||||
this.applyTorque(0.0001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue