From 2dc3120831fbcd03b635bbad59213ff0bf1f8879 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 13 Aug 2023 17:09:12 -0600 Subject: refactor velocity a bit for no real reason besides verbosity --- engine/components/Velocity.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engine/components/Velocity.ts') 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; } } } -- cgit v1.2.3-70-g09d2