aboutsummaryrefslogtreecommitdiff
path: root/engine/systems/WallBounds.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-25 16:48:17 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-25 16:48:17 -0600
commit773ce84f4bf559337e132edd7fcce02a0a2598fd (patch)
tree5fd0b452b459cc5a5b6a1ed98f2d7b9af950864d /engine/systems/WallBounds.ts
parentdec7b614d895a1b507137e4a96a8999ff63aa179 (diff)
downloadjumpstorm-773ce84f4bf559337e132edd7fcce02a0a2598fd.tar.gz
jumpstorm-773ce84f4bf559337e132edd7fcce02a0a2598fd.zip
prettier formatting
Diffstat (limited to 'engine/systems/WallBounds.ts')
-rw-r--r--engine/systems/WallBounds.ts20
1 files changed, 8 insertions, 12 deletions
diff --git a/engine/systems/WallBounds.ts b/engine/systems/WallBounds.ts
index a0d4a9c..7da84e4 100644
--- a/engine/systems/WallBounds.ts
+++ b/engine/systems/WallBounds.ts
@@ -1,28 +1,24 @@
-import { System, SystemNames } from ".";
-import { BoundingBox, ComponentNames } from "../components";
-import { Game } from "../Game";
-import type { Entity } from "../entities";
-import { clamp } from "../utils";
+import { System, SystemNames } from '.';
+import { BoundingBox, ComponentNames } from '../components';
+import { Game } from '../Game';
+import { clamp } from '../utils';
+import { Miscellaneous } from '../config';
export class WallBounds extends System {
- private screenWidth: number;
-
- constructor(screenWidth: number) {
+ constructor() {
super(SystemNames.WallBounds);
-
- this.screenWidth = screenWidth;
}
public update(_dt: number, game: Game) {
game.forEachEntityWithComponent(ComponentNames.WallBounded, (entity) => {
const boundingBox = entity.getComponent<BoundingBox>(
- ComponentNames.BoundingBox,
+ ComponentNames.BoundingBox
);
boundingBox.center.x = clamp(
boundingBox.center.x,
boundingBox.dimension.width / 2,
- this.screenWidth - boundingBox.dimension.width / 2,
+ Miscellaneous.WIDTH - boundingBox.dimension.width / 2
);
});
}