summaryrefslogtreecommitdiff
path: root/src/engine/systems/Input.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/systems/Input.ts')
-rw-r--r--src/engine/systems/Input.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/engine/systems/Input.ts b/src/engine/systems/Input.ts
index 9199c89..c527f29 100644
--- a/src/engine/systems/Input.ts
+++ b/src/engine/systems/Input.ts
@@ -32,20 +32,20 @@ export class Input extends System {
public update(_dt: number, game: Game) {
game.forEachEntityWithComponent(ComponentNames.Control, (entity) =>
- this.handleMovement(entity, game)
+ this.handleMovement(entity, game),
);
game.forEachEntityWithComponent(ComponentNames.Interactable, (entity) =>
- this.handleInteraction(entity)
+ this.handleInteraction(entity),
);
}
private handleInteraction(entity: Entity) {
const interactable = entity.getComponent<Interactable>(
- ComponentNames.Interactable
+ ComponentNames.Interactable,
);
const interact = this.hasSomeKey(
- KeyConstants.ActionKeys.get(Action.INTERACT)
+ KeyConstants.ActionKeys.get(Action.INTERACT),
);
if (!interact) {
@@ -54,13 +54,13 @@ export class Input extends System {
interactable.interact();
KeyConstants.ActionKeys.get(Action.INTERACT)!.forEach((key) =>
- this.keyReleased(key)
+ this.keyReleased(key),
);
}
public handleMovement(entity: Entity, game: Game) {
const controlComponent = entity.getComponent<Control>(
- ComponentNames.Control
+ ComponentNames.Control,
);
if (!controlComponent.isControllable) return;
@@ -85,22 +85,22 @@ export class Input extends System {
if (moveUp) {
gridComponent.movingDirection = Direction.UP;
KeyConstants.ActionKeys.get(Action.MOVE_UP)!.forEach((key) =>
- this.keyReleased(key)
+ this.keyReleased(key),
);
} else if (moveLeft) {
gridComponent.movingDirection = Direction.LEFT;
KeyConstants.ActionKeys.get(Action.MOVE_LEFT)!.forEach((key) =>
- this.keyReleased(key)
+ this.keyReleased(key),
);
} else if (moveRight) {
gridComponent.movingDirection = Direction.RIGHT;
KeyConstants.ActionKeys.get(Action.MOVE_RIGHT)!.forEach((key) =>
- this.keyReleased(key)
+ this.keyReleased(key),
);
} else if (moveDown) {
gridComponent.movingDirection = Direction.DOWN;
KeyConstants.ActionKeys.get(Action.MOVE_DOWN)!.forEach((key) =>
- this.keyReleased(key)
+ this.keyReleased(key),
);
}