diff --git a/package-lock.json b/package-lock.json index a8e4335..abd4bd9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,6 +61,32 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true, + "optional": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "optional": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true, + "optional": true + }, "@types/node": { "version": "12.12.29", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.29.tgz", @@ -150,6 +176,22 @@ } } }, + "asar": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/asar/-/asar-2.1.0.tgz", + "integrity": "sha512-d2Ovma+bfqNpvBzY/KU8oPY67ZworixTpkjSx0PCXnQi67c2cXmssaTxpFDUM0ttopXoGx/KRxNg/GDThYbXQA==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "chromium-pickle-js": "^0.2.0", + "commander": "^2.20.0", + "cuint": "^0.2.2", + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "tmp-promise": "^1.0.5" + } + }, "asdf-games": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/asdf-games/-/asdf-games-1.0.12.tgz", @@ -161,18 +203,36 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, + "author-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/author-regex/-/author-regex-1.0.0.tgz", + "integrity": "sha1-0IiFvmubv5Q5/gh8dihyRfCoFFA=", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, "binary-extensions": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", "dev": true }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, "boolean": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.1.tgz", @@ -199,6 +259,28 @@ "fill-range": "^7.0.1" } }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dev": true, + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", + "dev": true + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -243,6 +325,12 @@ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -284,6 +372,12 @@ "readdirp": "~3.3.0" } }, + "chromium-pickle-js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", + "integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU=", + "dev": true + }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -323,6 +417,18 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "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 + }, + "compare-version": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", + "integrity": "sha1-AWLsLZNR9d3VmpICy6k1NmpyUIA=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -386,6 +492,32 @@ } } }, + "cross-zip": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cross-zip/-/cross-zip-3.0.0.tgz", + "integrity": "sha512-cm+l8PJ6WiSQmKZ/x8DGvUm2u/3FX2JFs1AFd18gdHaVhP5Lf4oE6Jrj2Jd05JYSioz5x+nIRVp0zBQuzuCRcQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "cuint": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", + "integrity": "sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=", + "dev": true + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -395,6 +527,12 @@ "ms": "^2.1.1" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -459,6 +597,86 @@ "extract-zip": "^1.0.3" } }, + "electron-notarize": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-0.2.1.tgz", + "integrity": "sha512-oZ6/NhKeXmEKNROiFmRNfytqu3cxqC95sjooG7kBXQVEUSQkZnbiAhxVh5jXngL881G197pbwpeVPJyM7Ikmxw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + } + }, + "electron-osx-sign": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/electron-osx-sign/-/electron-osx-sign-0.4.15.tgz", + "integrity": "sha512-1QtPNpjIji9bGZ0VRFwtJUyU1uHi7q3XUAOG0qFsvAUfs5H0T8hbgUfyg3xvPzmF1ruV8T8pQmQ86vNfLrcRiA==", + "dev": true, + "requires": { + "bluebird": "^3.5.0", + "compare-version": "^0.1.2", + "debug": "^2.6.8", + "isbinaryfile": "^3.0.2", + "minimist": "^1.2.0", + "plist": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "electron-packager": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-14.2.1.tgz", + "integrity": "sha512-g6y3BVrAOz/iavKD+VMFbehrQcwCWuA3CZvVbmmbQuCfegGA1ytwWn0BNIDDrEdbuz31Fti7mnNHhb5L+3Wq9A==", + "dev": true, + "requires": { + "@electron/get": "^1.6.0", + "asar": "^2.0.1", + "cross-zip": "^3.0.0", + "debug": "^4.0.1", + "electron-notarize": "^0.2.0", + "electron-osx-sign": "^0.4.11", + "fs-extra": "^8.1.0", + "galactus": "^0.2.1", + "get-package-info": "^1.0.0", + "junk": "^3.1.0", + "parse-author": "^2.0.0", + "plist": "^3.0.0", + "rcedit": "^2.0.0", + "resolve": "^1.1.6", + "sanitize-filename": "^1.6.0", + "semver": "^6.0.0", + "yargs-parser": "^16.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "electron-reload": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/electron-reload/-/electron-reload-1.5.0.tgz", @@ -496,6 +714,15 @@ "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==", "dev": true }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", @@ -737,6 +964,15 @@ "to-regex-range": "^5.0.1" } }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -754,6 +990,29 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "flora-colossus": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-1.0.1.tgz", + "integrity": "sha512-d+9na7t9FyH8gBJoNDSi28mE4NgQVGGvxQ4aHtFRetjyh5SXjuus+V5EZaxFmFdXVemSOrx0lsgEl/ZMjnOWJA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "fs-extra": "^7.0.0" + }, + "dependencies": { + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -784,6 +1043,68 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "galactus": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/galactus/-/galactus-0.2.1.tgz", + "integrity": "sha1-y+0tIKQMH1Z5o1kI4rlBVzPnjbk=", + "dev": true, + "requires": { + "debug": "^3.1.0", + "flora-colossus": "^1.0.0", + "fs-extra": "^4.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, + "get-package-info": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-package-info/-/get-package-info-1.0.0.tgz", + "integrity": "sha1-ZDJ5ZWPigRPNlHTbvQAFKYWkmZw=", + "dev": true, + "requires": { + "bluebird": "^3.1.1", + "debug": "^2.2.0", + "lodash.get": "^4.0.0", + "read-pkg-up": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -895,6 +1216,12 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, "http-cache-semantics": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", @@ -1037,6 +1364,12 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1085,6 +1418,15 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isbinaryfile": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", + "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", + "dev": true, + "requires": { + "buffer-alloc": "^1.2.0" + } + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1141,6 +1483,12 @@ "graceful-fs": "^4.1.6" } }, + "junk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", + "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==", + "dev": true + }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -1160,12 +1508,48 @@ "type-check": "~0.3.2" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -1242,6 +1626,26 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -1316,6 +1720,30 @@ "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -1325,6 +1753,30 @@ "callsites": "^3.0.0" } }, + "parse-author": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-author/-/parse-author-2.0.0.tgz", + "integrity": "sha1-00YL8d3Q367tQtp1QkLmX7aEqB8=", + "dev": true, + "requires": { + "author-regex": "^1.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1337,6 +1789,29 @@ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -1356,6 +1831,17 @@ "dev": true, "optional": true }, + "plist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.1.tgz", + "integrity": "sha512-GpgvHHocGRyQm74b6FWEZZVRroHKE1I0/BTjAmySaohK+cUn+hZpbqXkc3KWgW3gQYkqcQej35FohcT0FRlkRQ==", + "dev": true, + "requires": { + "base64-js": "^1.2.3", + "xmlbuilder": "^9.0.7", + "xmldom": "0.1.x" + } + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -1403,6 +1889,33 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "rcedit": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/rcedit/-/rcedit-2.1.1.tgz", + "integrity": "sha512-N1JyXxHD2zpqqW4A77RNK1d/M+tyed9JkvL/lnUI5cf4igF/8B9FNLFCtDUhGrk2GWEPxC+RF0WXWWB3I8QC7w==", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -1433,6 +1946,15 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "resolve": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -1585,6 +2107,38 @@ } } }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, "sprintf-js": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", @@ -1640,6 +2194,12 @@ } } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -1722,6 +2282,27 @@ "os-tmpdir": "~1.0.2" } }, + "tmp-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-1.1.0.tgz", + "integrity": "sha512-8+Ah9aB1IRXCnIOxXZ0uFozV1nMU5xiu7hhFVUSxZ3bYu+psD4TzagCzVbexUCgNNGJnsmNDQlS4nG3mTyoNkw==", + "dev": true, + "requires": { + "bluebird": "^3.5.0", + "tmp": "0.1.0" + }, + "dependencies": { + "tmp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", + "integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", + "dev": true, + "requires": { + "rimraf": "^2.6.3" + } + } + } + }, "to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", @@ -1822,6 +2403,16 @@ "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -1852,6 +2443,28 @@ "mkdirp": "^0.5.1" } }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "dev": true + }, + "xmldom": { + "version": "0.1.31", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.31.tgz", + "integrity": "sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==", + "dev": true + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, "yauzl": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", diff --git a/package.json b/package.json index b44705d..0b1b056 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "devDependencies": { "electron": "^8.0.2", + "electron-packager": "^14.2.1", "electron-reload": "^1.5.0", "eslint": "^6.8.0" } diff --git a/res/aseprite/pointers.aseprite b/res/aseprite/pointers.aseprite new file mode 100644 index 0000000..43f0653 Binary files /dev/null and b/res/aseprite/pointers.aseprite differ diff --git a/res/pointers.png b/res/pointers.png new file mode 100644 index 0000000..c58d4f4 Binary files /dev/null and b/res/pointers.png differ diff --git a/src/entities/bullet.js b/src/entities/bullet.js new file mode 100644 index 0000000..bd152b6 --- /dev/null +++ b/src/entities/bullet.js @@ -0,0 +1,52 @@ +var asdf = require("asdf-games"); +// eslint-disable-next-line no-unused-vars +const { Texture, TileSprite, AnimManager, wallslide, entity } = asdf; + +const texture = new Texture("./res/tilemap.png"); + +class Bullet extends TileSprite { + constructor(pos, angle, parent, player, level) { + super(texture, 32, 32); + this.pos = pos; + this.pivot = { x: 21, y: 17 }; + this.rotation = angle; + this.scale = { x: 1, y: 1 }; + this.frame = { x: 1, y: 9 }; + + this.parent = parent; + this.player = player; + this.level = level; + + this.lifetime = 2.5; + this.speed = 100; + this.hitBox = { + x: 4, + y: 10, + w: 24, + h: 14 + }; + } + + update(dt) { + this.lifetime -= dt; + + if (this.lifetime <= 0) { + this.parent.bullet = false; + this.dead = true; + } else { + if (entity.hit(this, this.player)) { + this.player.lives -= 1; + this.parent.bullet = false; + this.dead = true; + } else { + const xo = Math.cos(this.rotation) * 100 * dt; + const yo = Math.sin(this.rotation) * 100 * dt; + + this.pos.x += xo; + this.pos.y += yo; + } + } + } +} + +module.exports = Bullet; \ No newline at end of file diff --git a/src/entities/chest.js b/src/entities/chest.js index 7abb59d..113a245 100644 --- a/src/entities/chest.js +++ b/src/entities/chest.js @@ -3,28 +3,32 @@ var asdf = require("asdf-games"); const { Texture, TileSprite, AnimManager, entity } = asdf; var texture = new Texture("./res/tilemap.png"); +var Pointer = require("./pointer.js"); const state = { open: 0, closed: 1 }; +const frames = { + closed: { x: 2, y: 6 }, + open: { x: 3, y: 6 } +}; + class Chest extends TileSprite { - constructor(pos, player, keys, action) { + constructor(pos, player, keys, level, action) { super(texture, 32, 32); this.pos = pos; this.scale = { x: 1, y: 1 }; - this.anims = new AnimManager(this); - this.anims.add("open", [{ x: 3, y: 6 }], 0.1); - this.anims.add("closed", [{ x: 2, y: 6 }], 0.1); - - this.anims.play("closed"); - + this.frame = frames.closed; this.state = state.closed; this.player = player; this.keys = keys; this.action = action; + this.level = level; + + this.pointer = false; this.hitBox = { x: 1, @@ -36,15 +40,36 @@ class Chest extends TileSprite { update(dt) { super.update(dt); - if (entity.hit(this, this.player) && this.keys.action && this.state == state.closed) { - this.state = state.open; - this.action(); + + if (entity.hit(this, this.player)) { + if (!this.pointer) { + var pointer = new Pointer({ + x: (this.pos.x + this.tileW / 2) - 8, + y: this.pos.y - 16 + }); + this.level.entities.add(pointer); + this.pointer = pointer; + } + + if (this.state == state.closed) { + this.pointer.anims.play("white"); + } else { + this.pointer.anims.play("red"); + } + + if (this.keys.action && this.state == state.closed) { + this.state = state.open; + this.action(); + } + } else { + this.level.entities.remove(this.pointer); + this.pointer = false; } if (this.state == state.closed) { - this.anims.play("closed"); + this.frame = frames.closed; } else if (this.state == state.open) { - this.anims.play("open"); + this.frame = frames.open; } } } diff --git a/src/entities/mage.js b/src/entities/mage.js index 4c79aec..161a275 100644 --- a/src/entities/mage.js +++ b/src/entities/mage.js @@ -2,12 +2,13 @@ var asdf = require("asdf-games"); // eslint-disable-next-line no-unused-vars const { Texture, TileSprite, AnimManager, wallslide, entity } = asdf; -var texture = new Texture("./res/mage.png"); +const Bullet = require("./bullet.js"); +const texture = new Texture("./res/mage.png"); const states = { idle: 0, attack: 1, - evade: 2 + move: 2 }; class Mage extends TileSprite { @@ -18,19 +19,28 @@ class Mage extends TileSprite { this.anims = new AnimManager(this); // North - this.anims.add("move_n", [4, 5, 6, 7].map(x => ({ x, y: 0 })), 0.1); + this.anims.add("move_n", [4, 5, 6, 7].map(x => ({ x, y: 0 })), 0.15); + this.anims.add("attack_n", [{ x: 4, y: 0 }], 0.1); // East - this.anims.add("move_e", [0, 1, 2, 3].map(x => ({ x, y: 1 })), 0.1); + this.anims.add("move_e", [0, 1, 2, 3].map(x => ({ x, y: 1 })), 0.15); + this.anims.add("attack_e", [{ x: 0, y: 1 }], 0.1); // South - this.anims.add("move_s", [0, 1, 2, 3].map(x => ({ x, y: 0 })), 0.1); + this.anims.add("move_s", [0, 1, 2, 3].map(x => ({ x, y: 0 })), 0.15); + this.anims.add("attack_s", [{ x: 0, y: 0 }], 0.1); // West - this.anims.add("move_w", [4, 5, 6, 7].map(x => ({ x, y: 1 })), 0.1); + this.anims.add("move_w", [4, 5, 6, 7].map(x => ({ x, y: 1 })), 0.15); + this.anims.add("attack_w", [{ x: 4, y: 1 }], 0.1); // Inactive this.anims.add("idle", [{ x: 0, y: 2 }], 0.1); this.anims.play("idle"); this.state = states.idle; + this.bullet = false; + this.shootrate = { + current: 0.5, + max: 2 + }; this.level = level; this.player = player; @@ -45,21 +55,23 @@ class Mage extends TileSprite { update(dt) { super.update(dt); + const angle = entity.angle(this.player, this); - if (entity.distance(this.player, this) < 100) { - this.state = states.attack; + if (entity.distance(this.player, this) <= 200) { + if (entity.distance(this.player, this) <= 100) { + this.state = states.attack; + } else { + this.state = states.move; + } } else { this.state = states.idle; } + + const xo = Math.cos(angle) * 75 * dt; + const yo = Math.sin(angle) * 75 * dt; + const r = wallslide.wallslide(this, this.level, xo, yo); - if (this.state != states.idle) { - // Move - - const angle = entity.angle(this.player, this); - const xo = Math.cos(angle) * 100 * dt; - const yo = Math.sin(angle) * 100 * dt; - const r = wallslide.wallslide(this, this.level, xo, yo); - + if (this.state == states.move && !this.bullet) { if (this.player.items.repellant) { this.pos.x -= r.x; this.pos.y -= r.y; @@ -84,10 +96,45 @@ class Mage extends TileSprite { this.anims.play("move_n"); } } + } else if (this.state == states.attack) { + if (this.shootrate.current <= 0 && !this.bullet) { + this.shoot(angle); + this.shootrate.current = this.shootrate.max; + } else { + this.shootrate.current -= dt; + } + + if (Math.abs(r.x) > Math.abs(r.y)) { + // Animation x axis + if (r.x >= 0) { + this.anims.play("attack_e"); + } else { + this.anims.play("attack_w"); + } + } else { + // Animation y axis + if (r.y >= 0) { + this.anims.play("attack_s"); + } else { + this.anims.play("attack_n"); + } + } + } else { this.anims.play("idle"); } } + + shoot(angle) { + console.log("shoot"); + this.bullet = true; + var pos = { + x: this.pos.x + 8, + y: this.pos.y + 8 + }; + var bullet = new Bullet(pos, angle, this, this.player, this.level); + this.level.entities.add(bullet); + } } module.exports = Mage; \ No newline at end of file diff --git a/src/entities/player.js b/src/entities/player.js index 1a5aaed..d6a734a 100644 --- a/src/entities/player.js +++ b/src/entities/player.js @@ -39,7 +39,7 @@ class Player extends TileSprite { this.lives = 5; this.items = { - keys: [], + keys: [ ], repellant: false }; diff --git a/src/entities/pointer.js b/src/entities/pointer.js new file mode 100644 index 0000000..ac637db --- /dev/null +++ b/src/entities/pointer.js @@ -0,0 +1,30 @@ +var asdf = require("asdf-games"); +// eslint-disable-next-line no-unused-vars +const { Texture, TileSprite, AnimManager, entity } = asdf; + +const texture = new Texture("./res/pointers.png"); + +// const states = { +// white: 0, +// red: 1 +// }; + +class Pointer extends TileSprite { + constructor(pos) { + super(texture, 8, 8); + this.pos = pos; + this.scale = { x: 2, y: 2 }; + + this.anims = new AnimManager(this); + this.anims.add("white", [0, 1, 2, 1].map(x => ({ x, y: 0 })), 0.15); + this.anims.add("red", [0, 1, 2, 1].map(x => ({ x, y: 1 })), 0.15); + + this.anims.play("white"); + } + + update(dt) { + super.update(dt); + } +} + +module.exports = Pointer; \ No newline at end of file diff --git a/src/entities/portal.js b/src/entities/portal.js index 331b2f4..42c654b 100644 --- a/src/entities/portal.js +++ b/src/entities/portal.js @@ -3,15 +3,18 @@ var asdf = require("asdf-games"); const { Texture, TileSprite, entity } = asdf; var texture = new Texture("./res/tilemap.png"); +var Pointer = require("./pointer.js"); class Portal extends TileSprite { - constructor(pos, player, keys, type, action, key) { + constructor(pos, player, keys, level, type, action, key) { super(texture, 32, 32); this.pos = pos; this.scale = { x: 1, y: 1 }; this.player = player; + this.level = level; this.action = action; + this.pointer = false; this.keys = keys; this.key = key; @@ -57,27 +60,47 @@ class Portal extends TileSprite { update(dt) { super.update(dt); - if (entity.hit(this, this.player) && this.keys.action) { + + if (entity.hit(this, this.player)) { + if (!this.pointer) { + var pointer = new Pointer({ + x: (this.pos.x + this.tileW / 2) - 8, + y: this.pos.y - 16 + }); + this.level.entities.add(pointer); + this.pointer = pointer; + } + if (this.key != "") { if (this.player.items.keys.length > 0) { for (let index = 0; index < this.player.items.keys.length; index++) { const element = this.player.items.keys[index]; if (element == this.key) { - this.action(); - this.player.items.key = false; - delete this.player.items.keys[index]; + // Correct key + this.pointer.anims.play("white"); + if (this.keys.action) { + this.action(); + } + break; } else { // Not the correct key + this.pointer.anims.play("red"); console.log("correct keyn't"); } } } else { // No keys at all + this.pointer.anims.play("red"); console.log("keyn't"); } } else { - this.action(); + if (this.keys.action) { + this.action(); + } } + } else { + this.level.entities.remove(this.pointer); + this.pointer = false; } } } diff --git a/src/game.js b/src/game.js index eaa4636..fe241c2 100644 --- a/src/game.js +++ b/src/game.js @@ -15,7 +15,7 @@ const mouseAim = new MouseControls(document.getElementById("board")); const keys = new KeyControls(); var Player = require("./src/entities/player.js"); -var Level = require("./src/levels/level.js"); +var Level = require("./src/helpers/level.js"); // Initialise first level 1-1.js at startPosition 0 var player = new Player(keys, window); @@ -38,6 +38,7 @@ function switchLevel(module, pos = 0) { var items = player.items; player = new Player(keys, window); e = new Level(module, keys, player); + level = e; player.pos.x = level.startPos[pos].x / 1; player.pos.y = level.startPos[pos].y / 1; player.items = items; @@ -61,7 +62,7 @@ game.run(() => { // Switch to another level if (level.switch) { switchLevel(require(level.switch.module), level.switch.pos); - delete level.switch; + level.switch = undefined; console.log(player); } diff --git a/src/levels/level.js b/src/helpers/level.js similarity index 81% rename from src/levels/level.js rename to src/helpers/level.js index 2f4cdc9..2cbe0fb 100644 --- a/src/levels/level.js +++ b/src/helpers/level.js @@ -1,6 +1,6 @@ var asdf = require("asdf-games"); // eslint-disable-next-line no-unused-vars -const { Texture, TileMap, entity } = asdf; +const { Texture, TileMap, entity, Container } = asdf; const texture = new Texture("./res/tilemap.png"); const tiles = require("../../res/tilemap.js"); @@ -27,6 +27,8 @@ class Level extends TileMap { this.keys = keys; this.player = player; + this.switch = false; + // Handle Entities for (let index = 0; index < level.entities.length; index++) { let e = level.entities[index]; @@ -35,15 +37,18 @@ class Level extends TileMap { e.entity = new Mage({ x: e.pos.x / 1, y: e.pos.y / 1 }, this.player, this); break; case "Chest": - e.entity = new Chest({ x: e.pos.x / 1, y: e.pos.y / 1 }, this.player, this.keys, () => { return e.action(this.player); }); + e.entity = new Chest({ x: e.pos.x / 1, y: e.pos.y / 1 }, this.player, this.keys, this, () => { return e.action(this.player); }); break; case "Portal": - e.entity = new Portal({ x: e.pos.x / 1, y: e.pos.y / 1 }, this.player, this.keys, e.texture, () => { return e.action(this.player, this); }, e.key); + e.entity = new Portal({ x: e.pos.x / 1, y: e.pos.y / 1 }, this.player, this.keys, this, e.texture, () => { return e.action(this.player, this); }, e.key); break; } this.children.push(e.entity); } + this.entities = new Container(); + this.children.push(this.entities); + } update(dt) { diff --git a/src/levels/1-1 copy.js b/src/levels/1-1 copy.js index e67ec40..4d6fafe 100644 --- a/src/levels/1-1 copy.js +++ b/src/levels/1-1 copy.js @@ -22,14 +22,14 @@ let level = { w: 960, h: 480 }, - startPos: { - x: 48, - y: 64 - }, + startPos: [ + { x: 48, y: 64 }, + { x: 48, y: 128 } + ], entities: [ { type: "Mage", - pos: { x: 9 * tileSize, y: 2 * tileSize } + pos: { x: 12 * tileSize, y: 2 * tileSize } }, { type: "Mage", @@ -39,16 +39,15 @@ let level = { type: "Chest", pos: { x: 4 * tileSize, y: 2 * tileSize }, action: (player) => { - player.items.keys.push("1-2_1"); + player.items.keys.push("1-2_3"); } }, { type: "Portal", pos: { x: 8 * tileSize, y: 2 * tileSize }, texture: "Ladder", - action: (player) => { - player.pos = {x:512,y:256}; - player.refocus = true; + action: (_player, level) => { + level.switch = { module: "./src/levels/1-1.js", pos: 0 }; }, key: "1-2_3" } diff --git a/src/levels/1-1.js b/src/levels/1-1.js index e510efc..ed935ba 100644 --- a/src/levels/1-1.js +++ b/src/levels/1-1.js @@ -29,7 +29,7 @@ let level = { entities: [ { type: "Mage", - pos: { x: 9 * tileSize, y: 2 * tileSize } + pos: { x: 12 * tileSize, y: 2 * tileSize } }, { type: "Mage", @@ -46,7 +46,7 @@ let level = { type: "Portal", pos: { x: 8 * tileSize, y: 2 * tileSize }, texture: "Ladder", - action: (player, level) => { + action: (_player, level) => { level.switch = { module: "./src/levels/1-1 copy.js", pos: 0 }; }, key: "1-1_1"