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/systems/Input.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'engine/systems/Input.ts') diff --git a/engine/systems/Input.ts b/engine/systems/Input.ts index 35d2e1d..d9b7133 100644 --- a/engine/systems/Input.ts +++ b/engine/systems/Input.ts @@ -39,20 +39,24 @@ export class Input extends System { public update(_dt: number, game: Game) { game.forEachEntityWithComponent(ComponentNames.Control, (entity) => { - const control = entity.getComponent(ComponentNames.Control); + const controlComponent = entity.getComponent( + ComponentNames.Control, + ); if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.MOVE_RIGHT))) { - control.controlVelocity.dCartesian.dx += + controlComponent.controlVelocityComponent.velocity.dCartesian.dx += PhysicsConstants.PLAYER_MOVE_VEL; } if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.MOVE_LEFT))) { - control.controlVelocity.dCartesian.dx += + controlComponent.controlVelocityComponent.velocity.dCartesian.dx += -PhysicsConstants.PLAYER_MOVE_VEL; } if (entity.hasComponent(ComponentNames.Jump)) { - const velocity = entity.getComponent(ComponentNames.Velocity); + const velocity = entity.getComponent( + ComponentNames.Velocity, + ).velocity; const jump = entity.getComponent(ComponentNames.Jump); if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.JUMP))) { -- cgit v1.3