From 98e795029bcc404463ed151ff5255a72498bc641 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 13 Aug 2023 16:47:58 -0600 Subject: Create network component and system --- engine/systems/Collision.ts | 6 +++++- engine/systems/Input.ts | 2 +- engine/systems/NetworkUpdate.ts | 10 ++++++++++ engine/systems/index.ts | 1 + engine/systems/names.ts | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 engine/systems/NetworkUpdate.ts (limited to 'engine/systems') diff --git a/engine/systems/Collision.ts b/engine/systems/Collision.ts index 2bba03b..1366ef4 100644 --- a/engine/systems/Collision.ts +++ b/engine/systems/Collision.ts @@ -63,7 +63,11 @@ export class Collision extends System { dimension = boundingBox.getOutscribedBoxDims(); } - this.quadTree.insert(entity.id, dimension, boundingBox.center); + this.quadTree.insert({ + id: entity.id, + dimension, + center: boundingBox.center, + }); }); // find colliding entities and perform collisions diff --git a/engine/systems/Input.ts b/engine/systems/Input.ts index 4aa9844..35d2e1d 100644 --- a/engine/systems/Input.ts +++ b/engine/systems/Input.ts @@ -9,7 +9,7 @@ import { import { Game } from "../Game"; import { KeyConstants, PhysicsConstants } from "../config"; import { Action } from "../interfaces"; -import { System, SystemNames } from "./"; +import { System, SystemNames } from "."; export class Input extends System { private keys: Set; diff --git a/engine/systems/NetworkUpdate.ts b/engine/systems/NetworkUpdate.ts new file mode 100644 index 0000000..dc7be20 --- /dev/null +++ b/engine/systems/NetworkUpdate.ts @@ -0,0 +1,10 @@ +import { System, SystemNames } from "."; +import { Game } from "../Game"; + +export class NetworkUpdate extends System { + constructor() { + super(SystemNames.NetworkUpdate); + } + + public update(_dt: number, _game: Game) {} +} diff --git a/engine/systems/index.ts b/engine/systems/index.ts index 6cb6f35..075fc4e 100644 --- a/engine/systems/index.ts +++ b/engine/systems/index.ts @@ -6,3 +6,4 @@ export * from "./Input"; export * from "./FacingDirection"; export * from "./Collision"; export * from "./WallBounds"; +export * from "./NetworkUpdate"; diff --git a/engine/systems/names.ts b/engine/systems/names.ts index 23f31fc..cf66422 100644 --- a/engine/systems/names.ts +++ b/engine/systems/names.ts @@ -5,4 +5,5 @@ export namespace SystemNames { export const Input = "Input"; export const Collision = "Collision"; export const WallBounds = "WallBounds"; + export const NetworkUpdate = "NetworkUpdate"; } -- cgit v1.2.3-70-g09d2