summaryrefslogtreecommitdiff
path: root/engine/systems/Input.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-13 17:09:12 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-13 17:09:12 -0600
commit2dc3120831fbcd03b635bbad59213ff0bf1f8879 (patch)
treedf1b6e88e8f0a9370e2cd321f52725524cc4d06d /engine/systems/Input.ts
parent98e795029bcc404463ed151ff5255a72498bc641 (diff)
downloadjumpstorm-2dc3120831fbcd03b635bbad59213ff0bf1f8879.tar.gz
jumpstorm-2dc3120831fbcd03b635bbad59213ff0bf1f8879.zip
refactor velocity a bit for no real reason besides verbosity
Diffstat (limited to 'engine/systems/Input.ts')
-rw-r--r--engine/systems/Input.ts12
1 files changed, 8 insertions, 4 deletions
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<Control>(ComponentNames.Control);
+ const controlComponent = entity.getComponent<Control>(
+ 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<Velocity>(ComponentNames.Velocity);
+ const velocity = entity.getComponent<Velocity>(
+ ComponentNames.Velocity,
+ ).velocity;
const jump = entity.getComponent<Jump>(ComponentNames.Jump);
if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.JUMP))) {