From c6e9baa0009f7cce0f6ff156a3957ef04a8cb684 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 12 Aug 2023 13:49:16 -0600 Subject: [PATCH] the great engine refactor --- client/src/JumpStorm.ts | 7 +- client/src/components/GameCanvas.svelte | 2 +- client/src/components/LeaderBoard.svelte | 3 +- client/src/components/LeaderBoardCard.svelte | 4 +- engine/Game.ts | 25 +++- engine/components/BoundingBox.ts | 57 ++++----- engine/components/Control.ts | 8 +- engine/components/Forces.ts | 2 +- engine/components/Sprite.ts | 6 +- engine/components/Velocity.ts | 10 +- engine/config/assets.ts | 10 +- engine/config/constants.ts | 8 +- engine/config/sprites.ts | 35 +++--- engine/entities/Entity.ts | 1 - engine/entities/Floor.ts | 14 ++- engine/entities/Player.ts | 15 +-- engine/interfaces/LeaderBoardEntry.ts | 5 - engine/interfaces/index.ts | 1 - engine/structures/QuadTree.ts | 91 +++++++++----- engine/systems/Collision.ts | 126 +++++++++---------- engine/systems/FacingDirection.ts | 25 ++-- engine/systems/Input.ts | 82 ++++++------ engine/systems/Physics.ts | 34 +++-- engine/systems/Render.ts | 55 ++++---- engine/systems/System.ts | 1 - engine/systems/WallBounds.ts | 27 ++-- engine/utils/index.ts | 1 - engine/utils/normalizeVector.ts | 8 -- server/src/server.ts | 16 +-- 29 files changed, 345 insertions(+), 334 deletions(-) delete mode 100644 engine/interfaces/LeaderBoardEntry.ts delete mode 100644 engine/utils/normalizeVector.ts diff --git a/client/src/JumpStorm.ts b/client/src/JumpStorm.ts index d1d1013..bd48483 100644 --- a/client/src/JumpStorm.ts +++ b/client/src/JumpStorm.ts @@ -17,11 +17,6 @@ export class JumpStorm { this.game = new Game(); this.socket = new WebSocket("ws://localhost:8080"); - this.socket.onopen = () => { - this.socket.send("gaming"); - console.log("OPENED SOCKET"); - }; - [ this.createInputSystem(), new FacingDirection(), @@ -32,7 +27,7 @@ export class JumpStorm { ].forEach((system) => this.game.addSystem(system)); [new Floor(160), new Player()].forEach((entity) => - this.game.addEntity(entity) + this.game.addEntity(entity), ); } diff --git a/client/src/components/GameCanvas.svelte b/client/src/components/GameCanvas.svelte index d7abecf..ae8c1b0 100644 --- a/client/src/components/GameCanvas.svelte +++ b/client/src/components/GameCanvas.svelte @@ -1,7 +1,7 @@
diff --git a/client/src/components/LeaderBoardCard.svelte b/client/src/components/LeaderBoardCard.svelte index f46c000..ae30e1a 100644 --- a/client/src/components/LeaderBoardCard.svelte +++ b/client/src/components/LeaderBoardCard.svelte @@ -1,7 +1,5 @@