summaryrefslogtreecommitdiff
path: root/engine/systems/Input.ts
diff options
context:
space:
mode:
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))) {