diff options
Diffstat (limited to 'engine/components/Velocity.ts')
-rw-r--r-- | engine/components/Velocity.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/engine/components/Velocity.ts b/engine/components/Velocity.ts index 068d8cd..aec0c03 100644 --- a/engine/components/Velocity.ts +++ b/engine/components/Velocity.ts @@ -3,21 +3,21 @@ import { Component } from "./Component"; import { ComponentNames } from "."; export class Velocity extends Component { - public dCartesian: Velocity2D; - public dTheta: number; + public velocity: Velocity2D; - constructor(dCartesian: Velocity2D = { dx: 0, dy: 0 }, dTheta: number = 0) { + constructor( + velocity: Velocity2D = { dCartesian: { dx: 0, dy: 0 }, dTheta: 0 }, + ) { super(ComponentNames.Velocity); - this.dCartesian = dCartesian; - this.dTheta = dTheta; + this.velocity = velocity; } - public add(velocity?: Velocity) { + public add(velocity?: Velocity2D) { if (velocity) { - this.dCartesian.dx += velocity.dCartesian.dx; - this.dCartesian.dy += velocity.dCartesian.dy; - this.dTheta += velocity.dTheta; + this.velocity.dCartesian.dx += velocity.dCartesian.dx; + this.velocity.dCartesian.dy += velocity.dCartesian.dy; + this.velocity.dTheta += velocity.dTheta; } } } |