diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-13 17:09:12 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-13 17:09:12 -0600 |
commit | 2dc3120831fbcd03b635bbad59213ff0bf1f8879 (patch) | |
tree | df1b6e88e8f0a9370e2cd321f52725524cc4d06d /engine/components | |
parent | 98e795029bcc404463ed151ff5255a72498bc641 (diff) | |
download | jumpstorm-2dc3120831fbcd03b635bbad59213ff0bf1f8879.tar.gz jumpstorm-2dc3120831fbcd03b635bbad59213ff0bf1f8879.zip |
refactor velocity a bit for no real reason besides verbosity
Diffstat (limited to 'engine/components')
-rw-r--r-- | engine/components/Control.ts | 6 | ||||
-rw-r--r-- | engine/components/Velocity.ts | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/engine/components/Control.ts b/engine/components/Control.ts index 1e782ee..fb7b916 100644 --- a/engine/components/Control.ts +++ b/engine/components/Control.ts @@ -1,11 +1,11 @@ import { Component, ComponentNames, Velocity } from "."; export class Control extends Component { - public controlVelocity: Velocity; + public controlVelocityComponent: Velocity; - constructor(controlVelocity: Velocity = new Velocity()) { + constructor(controlVelocityComponent: Velocity = new Velocity()) { super(ComponentNames.Control); - this.controlVelocity = controlVelocity; + this.controlVelocityComponent = controlVelocityComponent; } } 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; } } } |