diff --git a/.gitignore b/.gitignore index b6183af..ebe1430 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .cache/ *.map dist/improcket.min.js +node_modules diff --git a/README.md b/README.md index 89d1347..b04f218 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # Improcket -A little 2D space rocket game. Not done tho. +A little 2D space rocket game originally made for a game jam. ### Building -Install `rollup` and run `./rollup`. +`npm install` + +`npm run build` Host `dist/` on some static HTTP server. diff --git a/js/index.mjs b/js/index.mjs deleted file mode 100644 index 2bcb70c..0000000 --- a/js/index.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { init } from './game/index.mjs'; - -window.addEventListener('load', init); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b4c8baa --- /dev/null +++ b/package-lock.json @@ -0,0 +1,553 @@ +{ + "name": "improcket", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@rollup/plugin-typescript": "^11.1.6", + "rollup": "^2.79.1", + "rollup-plugin-terser": "^7.0.2", + "tslib": "^2.6.2" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.5", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "11.1.6", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz", + "integrity": "sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", + "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.12.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", + "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/jest-worker": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", + "integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-terser": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", + "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", + "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "jest-worker": "^26.2.1", + "serialize-javascript": "^4.0.0", + "terser": "^5.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/serialize-javascript": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/terser": { + "version": "5.31.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz", + "integrity": "sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..82a1681 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "scripts": { + "build": "rollup -c" + }, + "devDependencies": { + "@rollup/plugin-typescript": "^11.1.6", + "rollup": "^2.79.1", + "rollup-plugin-terser": "^7.0.2", + "tslib": "^2.6.2" + } +} diff --git a/rollup b/rollup deleted file mode 100755 index a39094c..0000000 --- a/rollup +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -npx rollup js/index.mjs --o dist/improcket.min.js -m --f es --watch diff --git a/rollup.config.js b/rollup.config.js new file mode 100755 index 0000000..9ef43dd --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,13 @@ +import typescript from '@rollup/plugin-typescript'; + +export default { + input: 'src/main.ts', + output: { + file: 'dist/improcket.min.js', + format: 'iife', + sourcemap: true + }, + plugins: [ + typescript(), + ] +}; diff --git a/js/assets.mjs b/src/assets.ts similarity index 100% rename from js/assets.mjs rename to src/assets.ts diff --git a/js/consts.mjs b/src/consts.ts similarity index 100% rename from js/consts.mjs rename to src/consts.ts diff --git a/js/data.mjs b/src/data.ts similarity index 100% rename from js/data.mjs rename to src/data.ts diff --git a/js/game/audio.mjs b/src/game/audio.ts similarity index 94% rename from js/game/audio.mjs rename to src/game/audio.ts index d103671..002815b 100644 --- a/js/game/audio.mjs +++ b/src/game/audio.ts @@ -1,4 +1,4 @@ -import {audio} from '../assets.mjs'; +import {audio} from '../assets'; const playing = new Map(); diff --git a/js/game/control.mjs b/src/game/control.ts similarity index 86% rename from js/game/control.mjs rename to src/game/control.ts index 279b588..eab0834 100644 --- a/js/game/control.mjs +++ b/src/game/control.ts @@ -1,11 +1,11 @@ -import * as input from '../input.mjs'; -import * as events from './events.mjs'; -import * as graphics from '../graphics/index.mjs'; -import * as inventory from './inventory.mjs'; -import * as audio from './audio.mjs'; -import * as world from '../world/index.mjs'; -import {playerShip} from '../world/index.mjs'; -import {state} from './index.mjs'; +import * as input from '../input'; +import * as events from './events'; +import * as graphics from '../graphics/index'; +import * as inventory from './inventory'; +import * as audio from './audio'; +import * as world from '../world/index'; +import {playerShip} from '../world/index'; +import {state} from './index'; export const mapping = { thrust: 'KeyW', diff --git a/js/game/edit.mjs b/src/game/edit.ts similarity index 93% rename from js/game/edit.mjs rename to src/game/edit.ts index d7564e0..6f7819b 100644 --- a/js/game/edit.mjs +++ b/src/game/edit.ts @@ -1,11 +1,11 @@ -import * as game from './index.mjs'; -import * as graphics from '../graphics/index.mjs'; -import * as world from '../world/index.mjs'; -import * as consts from '../consts.mjs'; -import * as events from './events.mjs'; -import * as inventory from './inventory.mjs'; -import {modules} from '../data.mjs'; -import {images as assets} from '../assets.mjs'; +import * as game from './index'; +import * as graphics from '../graphics/index'; +import * as world from '../world/index'; +import * as consts from '../consts'; +import * as events from './events'; +import * as inventory from './inventory'; +import {modules} from '../data'; +import {images as assets} from '../assets'; export let tiles = new Map(); export let width = 0; @@ -217,7 +217,11 @@ function posId(x, y) { } function getBoundaries() { - let sx = sy = ex = ey = null + let sx = null; + let sy = null; + let ex = null; + let ey = null; + tiles.forEach(t => { if (t.type === null) return; if (sx === null || t.x < sx) sx = t.x; diff --git a/js/game/events.mjs b/src/game/events.ts similarity index 92% rename from js/game/events.mjs rename to src/game/events.ts index 2875e2f..57a6b21 100644 --- a/js/game/events.mjs +++ b/src/game/events.ts @@ -1,11 +1,11 @@ -import * as game from './index.mjs'; -import * as graphics from '../graphics/index.mjs'; -import * as world from '../world/index.mjs'; -import * as inventory from './inventory.mjs'; -import * as particle from '../world/particle.mjs'; -import * as edit from './edit.mjs'; -import * as audio from './audio.mjs'; -import * as consts from '../consts.mjs'; +import * as game from './index'; +import * as graphics from '../graphics/index'; +import * as world from '../world/index'; +import * as inventory from './inventory'; +import * as particle from '../world/particle'; +import * as edit from './edit'; +import * as audio from './audio'; +import * as consts from '../consts'; export let shipLanded = false; export let score = 0; diff --git a/js/game/index.mjs b/src/game/index.ts similarity index 72% rename from js/game/index.mjs rename to src/game/index.ts index 0ea70cf..c87e477 100644 --- a/js/game/index.mjs +++ b/src/game/index.ts @@ -1,14 +1,14 @@ -import * as graphics from '../graphics/index.mjs'; -import * as gui from '../gui/index.mjs'; -import * as assets from '../assets.mjs'; -import * as input from '../input.mjs'; -import * as inventory from './inventory.mjs'; -import * as world from '../world/index.mjs'; -import * as events from './events.mjs'; -import * as control from './control.mjs'; -import * as edit from './edit.mjs'; +import * as graphics from '../graphics/index'; +import * as gui from '../gui/index'; +import * as assets from '../assets'; +import * as input from '../input'; +import * as inventory from './inventory'; +import * as world from '../world/index'; +import * as events from './events'; +import * as control from './control'; +import * as edit from './edit'; -export let state; +export let state: any; export async function init() { state = { diff --git a/js/game/inventory.mjs b/src/game/inventory.ts similarity index 89% rename from js/game/inventory.mjs rename to src/game/inventory.ts index 6d75bf6..e61eddd 100644 --- a/js/game/inventory.mjs +++ b/src/game/inventory.ts @@ -1,9 +1,9 @@ -import {state} from './index.mjs'; -import {modules} from '../data.mjs'; -import {playerShip} from '../world/index.mjs'; -import {images as assets} from '../assets.mjs'; -import * as edit from '../game/edit.mjs'; -import * as events from './events.mjs'; +import {state} from './index'; +import {modules} from '../data'; +import {playerShip} from '../world/index'; +import {images as assets} from '../assets'; +import * as edit from './edit'; +import * as events from './events'; export const items = new Map(); export let currentItem = null; diff --git a/js/graphics/background.mjs b/src/graphics/background.ts similarity index 90% rename from js/graphics/background.mjs rename to src/graphics/background.ts index 38dc3b9..f04725e 100644 --- a/js/graphics/background.mjs +++ b/src/graphics/background.ts @@ -1,5 +1,5 @@ -import {canvas, context, perspective} from './index.mjs'; -import {images as assets} from '../assets.mjs'; +import {canvas, context, perspective} from './index'; +import {images as assets} from '../assets'; let patterns = null; diff --git a/js/graphics/draw.mjs b/src/graphics/draw.ts similarity index 86% rename from js/graphics/draw.mjs rename to src/graphics/draw.ts index cd49753..b4c2950 100644 --- a/js/graphics/draw.mjs +++ b/src/graphics/draw.ts @@ -1,4 +1,4 @@ -import {canvas, context} from './index.mjs'; +import {canvas, context} from './index'; export function text(string, x, y, {font = '52pt Arial', align = 'left', valign = 'top', color = null}) { diff --git a/js/graphics/gui.mjs b/src/graphics/gui.ts similarity index 96% rename from js/graphics/gui.mjs rename to src/graphics/gui.ts index 67a6b13..5c7a591 100644 --- a/js/graphics/gui.mjs +++ b/src/graphics/gui.ts @@ -1,6 +1,6 @@ -import {canvas, context} from './index.mjs'; -import * as gui from '../gui/index.mjs'; -import * as draw from './draw.mjs'; +import {canvas, context} from './index'; +import * as gui from '../gui/index'; +import * as draw from './draw'; export function render() { renderElement(gui.root); diff --git a/js/graphics/index.mjs b/src/graphics/index.ts similarity index 94% rename from js/graphics/index.mjs rename to src/graphics/index.ts index f94f44a..8bbe2fd 100644 --- a/js/graphics/index.mjs +++ b/src/graphics/index.ts @@ -1,10 +1,10 @@ -import * as gui from './gui.mjs'; -import * as draw from './draw.mjs'; -import * as input from '../input.mjs'; -import {render as renderWorld} from './world.mjs'; -import {render as renderBackground} from './background.mjs'; -import * as world from '../world/index.mjs'; -import * as consts from '../consts.mjs'; +import * as gui from './gui'; +import * as draw from './draw'; +import * as input from '../input'; +import {render as renderWorld} from './world'; +import {render as renderBackground} from './background'; +import * as world from '../world/index'; +import * as consts from '../consts'; const TAU = consts.TAU; diff --git a/js/graphics/world.mjs b/src/graphics/world.ts similarity index 78% rename from js/graphics/world.mjs rename to src/graphics/world.ts index 532be54..cb3a426 100644 --- a/js/graphics/world.mjs +++ b/src/graphics/world.ts @@ -1,15 +1,17 @@ -import { canvas, context } from './index.mjs'; -import * as graphics from './index.mjs'; -import { images as assets } from '../assets.mjs'; -import * as world from '../world/index.mjs'; -import { state } from '../game/index.mjs'; +import { canvas, context } from './index'; +import * as graphics from './index'; +import { images as assets } from '../assets'; +import * as world from '../world/index'; +import { state } from '../game/index'; export function render() { - for (particle of world.particles) renderParticle(particle); - for (celestial of world.celestials) if (isVisible(celestial)) renderCelestial(celestial); - if (graphics.trace) for (tracer of world.tracers) renderTracer(tracer); - for (ship of world.ships) renderShip(ship); - for (entity of world.entities) if (isVisible(entity)) renderEntity(entity); + for (const particle of world.particles) renderParticle(particle); + for (const celestial of world.celestials) if (isVisible(celestial)) renderCelestial(celestial); + if (graphics.trace) { + for (const tracer of world.tracers) renderTracer(tracer); + } + for (const ship of world.ships) renderShip(ship); + for (const entity of world.entities) if (isVisible(entity)) renderEntity(entity); /* if (typeof window.q === 'undefined') window.q = []; diff --git a/js/gui/button.mjs b/src/gui/button.ts similarity index 78% rename from js/gui/button.mjs rename to src/gui/button.ts index 0a85267..4f5ba2e 100644 --- a/js/gui/button.mjs +++ b/src/gui/button.ts @@ -1,5 +1,5 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; +import * as gui from './index'; +import GuiElement from './element'; export default class GuiButton extends GuiElement { constructor(text, onclick, x, y, w = 100, h = 30) { diff --git a/js/gui/edit.mjs b/src/gui/edit.ts similarity index 87% rename from js/gui/edit.mjs rename to src/gui/edit.ts index 417f1f3..c35897e 100644 --- a/js/gui/edit.mjs +++ b/src/gui/edit.ts @@ -1,9 +1,9 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; -import GuiItemButton from './item.mjs'; -import {state} from '../game/index.mjs'; -import * as edit from '../game/edit.mjs'; -import * as inventory from './inventory.mjs'; +import * as gui from './index'; +import GuiElement from './element'; +import GuiItemButton from './item'; +import {state} from '../game/index'; +import * as edit from '../game/edit'; +import * as inventory from './inventory'; export default class GuiEdit extends GuiElement { constructor(x, y, w = 100, h = 30) { diff --git a/js/gui/element.mjs b/src/gui/element.ts similarity index 97% rename from js/gui/element.mjs rename to src/gui/element.ts index 56516f8..4ed4301 100644 --- a/js/gui/element.mjs +++ b/src/gui/element.ts @@ -1,4 +1,4 @@ -import {Rect} from './misc.mjs'; +import {Rect} from './misc'; const defaultOptions = { draw: true, // Whether the element itself will be rendered. diff --git a/js/gui/frame.mjs b/src/gui/frame.ts similarity index 65% rename from js/gui/frame.mjs rename to src/gui/frame.ts index 5fac4ce..1a86f29 100644 --- a/js/gui/frame.mjs +++ b/src/gui/frame.ts @@ -1,5 +1,5 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; +import * as gui from './index'; +import GuiElement from './element'; export default class GuiFrame extends GuiElement { constructor(x, y, w, h, options) { diff --git a/js/gui/image.mjs b/src/gui/image.ts similarity index 87% rename from js/gui/image.mjs rename to src/gui/image.ts index 853da5a..4e99fe4 100644 --- a/js/gui/image.mjs +++ b/src/gui/image.ts @@ -1,5 +1,5 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; +import * as gui from './index'; +import GuiElement from './element'; export default class GuiImage extends GuiElement { constructor(src, x, y, w, h) { diff --git a/js/gui/index.mjs b/src/gui/index.ts similarity index 87% rename from js/gui/index.mjs rename to src/gui/index.ts index e71b5fb..21beec8 100644 --- a/js/gui/index.mjs +++ b/src/gui/index.ts @@ -1,5 +1,5 @@ -import {context} from '../graphics/index.mjs'; -import * as modules from './modules.mjs'; +import {context} from '../graphics/index'; +import * as modules from './modules'; export const elements = new Set(); export let root; diff --git a/js/gui/inventory.mjs b/src/gui/inventory.ts similarity index 91% rename from js/gui/inventory.mjs rename to src/gui/inventory.ts index e0e38d5..7864307 100644 --- a/js/gui/inventory.mjs +++ b/src/gui/inventory.ts @@ -1,8 +1,8 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; -import GuiItemButton from './item.mjs'; -import {state} from '../game/index.mjs'; -import * as inventory from '../game/inventory.mjs'; +import * as gui from './index'; +import GuiElement from './element'; +import GuiItemButton from './item'; +import {state} from '../game/index'; +import * as inventory from '../game/inventory'; export default class GuiInventory extends GuiElement { constructor(x, y, w = 100, h = 30) { diff --git a/js/gui/item.mjs b/src/gui/item.ts similarity index 87% rename from js/gui/item.mjs rename to src/gui/item.ts index e7e67d5..d54ea4c 100644 --- a/js/gui/item.mjs +++ b/src/gui/item.ts @@ -1,5 +1,5 @@ -import * as gui from './index.mjs'; -import GuiButton from './button.mjs'; +import * as gui from './index'; +import GuiButton from './button'; export default class GuiItemButton extends GuiButton { constructor(tile, onclick, x, y, w = 50, h = 50, { diff --git a/js/gui/misc.mjs b/src/gui/misc.ts similarity index 96% rename from js/gui/misc.mjs rename to src/gui/misc.ts index 77e5117..fe62040 100644 --- a/js/gui/misc.mjs +++ b/src/gui/misc.ts @@ -1,4 +1,4 @@ -import * as input from '../input.mjs'; +import * as input from '../input'; export class Rect { constructor(x = 0, y = 0, w = 0, h = 0) { diff --git a/js/gui/modules.mjs b/src/gui/modules.ts similarity index 91% rename from js/gui/modules.mjs rename to src/gui/modules.ts index 67ba050..e45f025 100644 --- a/js/gui/modules.mjs +++ b/src/gui/modules.ts @@ -1,17 +1,17 @@ -import * as gui from './index.mjs'; -import {message as editMessage} from '../game/edit.mjs'; -import {images as assets} from '../assets.mjs'; -import {canvas} from '../graphics/index.mjs'; -import GuiFrame from './frame.mjs'; -import GuiImage from './image.mjs'; -import GuiButton from './button.mjs'; -import GuiEdit from './edit.mjs'; -import GuiText from './text.mjs'; -import GuiInventory from './inventory.mjs'; -import * as inventory from '../game/inventory.mjs'; -import * as events from '../game/events.mjs'; -import {state} from '../game/index.mjs'; -import * as world from '../world/index.mjs'; +import * as gui from './index'; +import {message as editMessage} from '../game/edit'; +import {images as assets} from '../assets'; +import {canvas} from '../graphics/index'; +import GuiFrame from './frame'; +import GuiImage from './image'; +import GuiButton from './button'; +import GuiEdit from './edit'; +import GuiText from './text'; +import GuiInventory from './inventory'; +import * as inventory from '../game/inventory'; +import * as events from '../game/events'; +import {state} from '../game/index'; +import * as world from '../world/index'; export function root() { return new GuiFrame(0, 0, canvas.width, canvas.height, { diff --git a/js/gui/text.mjs b/src/gui/text.ts similarity index 89% rename from js/gui/text.mjs rename to src/gui/text.ts index 2cadfe6..0e0bdbb 100644 --- a/js/gui/text.mjs +++ b/src/gui/text.ts @@ -1,6 +1,6 @@ -import * as gui from './index.mjs'; -import GuiElement from './element.mjs'; -import {context} from '../graphics/index.mjs'; +import * as gui from './index'; +import GuiElement from './element'; +import {context} from '../graphics/index'; export default class GuiText extends GuiElement { constructor(text = '', x, y, w, h, { diff --git a/js/input.mjs b/src/input.ts similarity index 70% rename from js/input.mjs rename to src/input.ts index 3ca77a3..10143c1 100644 --- a/js/input.mjs +++ b/src/input.ts @@ -1,4 +1,4 @@ -import {canvas} from './graphics/index.mjs'; +import {canvas} from './graphics/index'; export const mouse = { pressed: {}, held: {}, x: 0, y: 0, scroll: 0 }; export const keyCode = { pressed: {}, held: {} }; @@ -26,11 +26,10 @@ export function init() { keyCode.held[event.code] = false; key.held[event.key] = false; }); - // Ṕ͕͖ẖ̨’̖̺͓̪̹n̼͇͔̯̝̖g̙̩̭͕ͅͅl̻̰͘u͎̥͍̗ͅi̼̞̪̩͚̜͖ ̫̝̻͚͟m͎̳̙̭̩̩̕g̟̤̬̮l̫̕w̶͚͈͚̟͔’͖n͏̝͖̞̺ͅa͏̹͓̬̺f̗̬̬̬̖̫͜h͙̘̝̱̬̗͜ ̼͎͖C̱͔̱͖ṭ̬̱͖h̵̰̼̘̩ùlh̙́u̪̫ ̪̺̹̙̯R̞͓̹̞’͍͎͉͎̦͙ͅl͇̠̮y̙̪̰̪͙̖e̢̩͉͙̼h̗͔̹̳ ̶w̨̼͍̝̭̣̣ͅg̶̳̦̳a̴͉̹͙̭̟ͅh͈͎̞̜͉́’̼̜̠͞n̲a̯g̮͚͓̝l̠ ̹̹̱͙̝f̧̝͖̱h̪̟̻͖̖t͎͘aͅg̤̘͜n̶͈̻̻̝̳ + window.addEventListener('mousedown', event => { mouse.pressed[event.button] = !mouse.held[event.button]; mouse.held[event.button] = true; - tickAfterMouse = false; }); window.addEventListener('mouseup', event => { diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..4dd2c2f --- /dev/null +++ b/src/main.ts @@ -0,0 +1,3 @@ +import { init } from './game/index'; + +window.addEventListener('load', init); diff --git a/js/util.mjs b/src/util.ts similarity index 100% rename from js/util.mjs rename to src/util.ts diff --git a/js/world/body.mjs b/src/world/body.ts similarity index 97% rename from js/world/body.mjs rename to src/world/body.ts index 86d126c..687c20a 100644 --- a/js/world/body.mjs +++ b/src/world/body.ts @@ -1,4 +1,4 @@ -import {GRAVITATIONAL_CONSTANT as G, TAU} from '../consts.mjs'; +import {GRAVITATIONAL_CONSTANT as G, TAU} from '../consts'; export default class Body { constructor(x, y, mass) { diff --git a/js/world/celestial.mjs b/src/world/celestial.ts similarity index 82% rename from js/world/celestial.mjs rename to src/world/celestial.ts index 0bfe0c7..626c4b1 100644 --- a/js/world/celestial.mjs +++ b/src/world/celestial.ts @@ -1,7 +1,7 @@ -import {tempCanvas, tempContext} from '../graphics/index.mjs'; -import {images as assets} from '../assets.mjs'; -import Body from './body.mjs'; -import { PLANET_IMAGE_SIZE } from '../consts.mjs'; +import {tempCanvas, tempContext} from '../graphics/index'; +import {images as assets} from '../assets'; +import Body from './body'; +import { PLANET_IMAGE_SIZE } from '../consts'; export default class Celestial extends Body { constructor(x, y, radius, { diff --git a/js/world/entity.mjs b/src/world/entity.ts similarity index 80% rename from js/world/entity.mjs rename to src/world/entity.ts index 847275d..3d406a4 100644 --- a/js/world/entity.mjs +++ b/src/world/entity.ts @@ -1,11 +1,11 @@ -import Body from './body.mjs'; -import {modules} from '../data.mjs'; -import {playerShip} from './index.mjs'; -import {images as assets} from '../assets.mjs'; -import {celestials, particles, entities} from './index.mjs'; -import * as particle from './particle.mjs'; -import * as consts from '../consts.mjs'; -import * as events from '../game/events.mjs'; +import Body from './body'; +import {modules} from '../data'; +import {playerShip} from './index'; +import {images as assets} from '../assets'; +import {celestials, particles, entities} from './index'; +import * as particle from './particle'; +import * as consts from '../consts'; +import * as events from '../game/events'; export default class Entity extends Body { constructor(x, y, type = 'fuel', id = 'small', { diff --git a/js/world/index.mjs b/src/world/index.ts similarity index 91% rename from js/world/index.mjs rename to src/world/index.ts index 3c4504c..78b7373 100644 --- a/js/world/index.mjs +++ b/src/world/index.ts @@ -1,5 +1,5 @@ -import * as spawn from './spawn.mjs'; -import * as graphics from '../graphics/index.mjs'; +import * as spawn from './spawn'; +import * as graphics from '../graphics/index'; export const entities = new Set(); export const celestials = new Set(); diff --git a/js/world/module.mjs b/src/world/module.ts similarity index 90% rename from js/world/module.mjs rename to src/world/module.ts index 6c6fe3e..4352427 100644 --- a/js/world/module.mjs +++ b/src/world/module.ts @@ -1,5 +1,5 @@ -import {modules} from '../data.mjs'; -import {images as assets} from '../assets.mjs'; +import {modules} from '../data'; +import {images as assets} from '../assets'; export default class Module { constructor(x, y, ship, { diff --git a/js/world/particle.mjs b/src/world/particle.ts similarity index 97% rename from js/world/particle.mjs rename to src/world/particle.ts index 5e28cd5..676f847 100644 --- a/js/world/particle.mjs +++ b/src/world/particle.ts @@ -1,5 +1,5 @@ -import Body from './body.mjs'; -import {celestials, particles} from './index.mjs'; +import Body from './body'; +import {celestials, particles} from './index'; export function createThrustExhaust(thruster) { let ship = thruster.ship; diff --git a/js/world/ship.mjs b/src/world/ship.ts similarity index 94% rename from js/world/ship.mjs rename to src/world/ship.ts index b975b2a..0f1bf7c 100644 --- a/js/world/ship.mjs +++ b/src/world/ship.ts @@ -1,11 +1,11 @@ -import Module from './module.mjs'; -import Body from './body.mjs'; -import * as world from './index.mjs'; -import * as consts from '../consts.mjs'; -import * as particle from './particle.mjs'; -import * as events from '../game/events.mjs'; -import Tracer from './tracer.mjs'; -import {state} from '../game/index.mjs'; +import Module from './module'; +import Body from './body'; +import * as world from './index'; +import * as consts from '../consts'; +import * as particle from './particle'; +import * as events from '../game/events'; +import Tracer from './tracer'; +import {state} from '../game/index'; export default class Ship extends Body { constructor(x, y) { diff --git a/js/world/spawn.mjs b/src/world/spawn.ts similarity index 91% rename from js/world/spawn.mjs rename to src/world/spawn.ts index 872289e..5b926ab 100644 --- a/js/world/spawn.mjs +++ b/src/world/spawn.ts @@ -1,12 +1,12 @@ -import Ship from './ship.mjs'; -import Module from './module.mjs'; -import Celestial from './celestial.mjs'; -import Entity from './entity.mjs'; -import Tracer from './tracer.mjs'; -import {modules} from '../data.mjs'; -import * as world from './index.mjs'; -import * as consts from '../consts.mjs'; -import {SECTOR_SIZE as SS} from '../consts.mjs'; +import Ship from './ship'; +import Module from './module'; +import Celestial from './celestial'; +import Entity from './entity'; +import Tracer from './tracer'; +import {modules} from '../data'; +import * as world from './index'; +import * as consts from '../consts'; +import {SECTOR_SIZE as SS} from '../consts'; let spawnedSectors = new Map(); diff --git a/js/world/tracer.mjs b/src/world/tracer.ts similarity index 70% rename from js/world/tracer.mjs rename to src/world/tracer.ts index 704cb53..dea7eef 100644 --- a/js/world/tracer.mjs +++ b/src/world/tracer.ts @@ -1,11 +1,11 @@ -import Body from './body.mjs'; -import {modules} from '../data.mjs'; -import {playerShip} from './index.mjs'; -import {images as assets} from '../assets.mjs'; -import {celestials, particles, entities} from './index.mjs'; -import * as particle from './particle.mjs'; -import * as consts from '../consts.mjs'; -import * as events from '../game/events.mjs'; +import Body from './body'; +import {modules} from '../data'; +import {playerShip} from './index'; +import {images as assets} from '../assets'; +import {celestials, particles, entities} from './index'; +import * as particle from './particle'; +import * as consts from '../consts'; +import * as events from '../game/events'; export default class Tracer extends Body { constructor(ship) { diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..4cc7f1f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es2022", + "module": "esnext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": false, + "skipLibCheck": true, + "outDir": "out", + }, + "include": ["./src/**/*.ts"] +}