diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f81d56e --- /dev/null +++ b/.gitignore @@ -0,0 +1,169 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +\*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +\*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +\*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +\*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.cache +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +.cache/ + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp +.cache + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.\* diff --git a/client/lib/systems/WallBounds.ts b/client/lib/systems/WallBounds.ts deleted file mode 100644 index 3fd5dc4..0000000 --- a/client/lib/systems/WallBounds.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { System, SystemNames } from "."; -import { BoundingBox, ComponentNames } from "../components"; -import type { Entity } from "../entities"; - -export class WallBounds extends System { - private screenWidth: number; - - constructor(screenWidth: number) { - super(SystemNames.WallBounds); - - this.screenWidth = screenWidth; - } - - public update( - _dt: number, - entityMap: Map, - componentEntities: Map> - ) { - componentEntities.get(ComponentNames.WallBounded)?.forEach((entityId) => { - const entity = entityMap.get(entityId); - if (!entity.hasComponent(ComponentNames.BoundingBox)) { - return; - } - - const boundingBox = entity.getComponent( - ComponentNames.BoundingBox - ); - - boundingBox.center.x = Math.min( - this.screenWidth - boundingBox.dimension.width / 2, - Math.max(boundingBox.dimension.width / 2, boundingBox.center.x) - ); - }); - } -} diff --git a/client/package-lock.json b/client/package-lock.json index 641f566..bf627d9 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "client", "version": "0.0.0", + "dependencies": { + "module-alias": "^2.2.3" + }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^2.0.4", "@tsconfig/svelte": "^4.0.1", @@ -1585,6 +1588,11 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/module-alias": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz", + "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==" + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", diff --git a/client/package.json b/client/package.json index 1ddd2b8..43c1b66 100644 --- a/client/package.json +++ b/client/package.json @@ -20,5 +20,8 @@ "tslib": "^2.5.0", "typescript": "^5.0.2", "vite": "^4.3.9" + }, + "dependencies": { + "module-alias": "^2.2.3" } } diff --git a/client/lib/JumpStorm.ts b/client/src/JumpStorm.ts similarity index 90% rename from client/lib/JumpStorm.ts rename to client/src/JumpStorm.ts index c76d9bc..45ea163 100644 --- a/client/lib/JumpStorm.ts +++ b/client/src/JumpStorm.ts @@ -1,5 +1,5 @@ -import { Floor, Player } from "./entities"; -import { Game } from "./Game"; +import { Floor, Player } from "@engine/entities"; +import { Game } from "@engine/Game"; import { WallBounds, FacingDirection, @@ -7,7 +7,7 @@ import { Physics, Input, Collision, -} from "./systems"; +} from "@engine/systems"; export class JumpStorm { private game: Game; diff --git a/client/src/components/GameCanvas.svelte b/client/src/components/GameCanvas.svelte index 766a08a..d7abecf 100644 --- a/client/src/components/GameCanvas.svelte +++ b/client/src/components/GameCanvas.svelte @@ -1,11 +1,8 @@