diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/Game.ts | 1 | ||||
-rw-r--r-- | engine/config/constants.ts | 5 | ||||
-rw-r--r-- | engine/systems/Collision.ts | 4 |
3 files changed, 8 insertions, 2 deletions
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<number>) => - entityIds.forEach((id) => { + ).forEach((entityIds?: Set<number>) => + entityIds?.forEach((id) => { const entity = game.entities.get(id); if (!entity.hasComponent(ComponentNames.BoundingBox)) { return; |