From 619a039942c3c02552f72275634a9f6c0788c570 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 20 Jul 2023 22:22:26 -0700 Subject: very basic websocket setup --- engine/Game.ts | 1 + engine/config/constants.ts | 5 +++++ engine/systems/Collision.ts | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/Game.ts b/engine/Game.ts index c2a2c4f..3682fbd 100644 --- a/engine/Game.ts +++ b/engine/Game.ts @@ -55,6 +55,7 @@ export class Game { const dt = timeStamp - this.lastTimeStamp; this.lastTimeStamp = timeStamp; + // rebuild the Component -> { Entity } map this.componentEntities.clear(); this.entities.forEach((entity) => entity.getComponents().forEach((component) => { diff --git a/engine/config/constants.ts b/engine/config/constants.ts index 27c8160..9a3169b 100644 --- a/engine/config/constants.ts +++ b/engine/config/constants.ts @@ -32,3 +32,8 @@ export namespace PhysicsConstants { export const PLAYER_JUMP_ACC = -0.01; export const PLAYER_JUMP_INITIAL_VEL = -0.9; } + +export namespace Miscellaneous { + export const WIDTH = 600; + export const HEIGHT = 800; +} diff --git a/engine/systems/Collision.ts b/engine/systems/Collision.ts index 4fcb906..846a95a 100644 --- a/engine/systems/Collision.ts +++ b/engine/systems/Collision.ts @@ -42,8 +42,8 @@ export class Collision extends System { Collision.COLLIDABLE_COMPONENT_NAMES.map((componentName) => game.componentEntities.get(componentName) - ).forEach((entityIds: Set) => - entityIds.forEach((id) => { + ).forEach((entityIds?: Set) => + entityIds?.forEach((id) => { const entity = game.entities.get(id); if (!entity.hasComponent(ComponentNames.BoundingBox)) { return; -- cgit v1.2.3-70-g09d2