summaryrefslogtreecommitdiff
path: root/engine/systems/WallBounds.ts
diff options
context:
space:
mode:
authorElizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz>2023-08-26 17:57:05 -0600
committerGitHub <noreply@github.com>2023-08-26 17:57:05 -0600
commit8a4ab8d79b5ce1dabb431168398b5d5111fe326c (patch)
treee60767dc5295edf379cf421e20171dc418e548b7 /engine/systems/WallBounds.ts
parentc6e9baa0009f7cce0f6ff156a3957ef04a8cb684 (diff)
parent6ce6946a4401d2ee6fa5cb747fab7d4c658a63c8 (diff)
downloadjumpstorm-8a4ab8d79b5ce1dabb431168398b5d5111fe326c.tar.gz
jumpstorm-8a4ab8d79b5ce1dabb431168398b5d5111fe326c.zip
Merge pull request #1 from Simponic/network
Network
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
);
});
}