{"id":15061057,"url":"https://github.com/16patsle/phaser3-weapon-plugin","last_synced_at":"2025-08-19T11:32:26.083Z","repository":{"id":32575153,"uuid":"134062348","full_name":"16patsle/phaser3-weapon-plugin","owner":"16patsle","description":"Weapon Plugin for Phaser 3, ported from the one included in Phaser CE","archived":false,"fork":false,"pushed_at":"2024-09-25T16:02:55.000Z","size":3713,"stargazers_count":24,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-17T05:41:51.053Z","etag":null,"topics":["hacktoberfest","phaser","phaser3","phaser3-plugin","typescript"],"latest_commit_sha":null,"homepage":"https://16patsle.github.io/phaser3-weapon-plugin/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/16patsle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-19T13:02:37.000Z","updated_at":"2024-09-25T16:02:59.000Z","dependencies_parsed_at":"2023-01-14T21:38:01.622Z","dependency_job_id":null,"html_url":"https://github.com/16patsle/phaser3-weapon-plugin","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/16patsle%2Fphaser3-weapon-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/16patsle%2Fphaser3-weapon-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/16patsle%2Fphaser3-weapon-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/16patsle%2Fphaser3-weapon-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/16patsle","download_url":"https://codeload.github.com/16patsle/phaser3-weapon-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230351169,"owners_count":18212788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","phaser","phaser3","phaser3-plugin","typescript"],"created_at":"2024-09-24T23:08:39.934Z","updated_at":"2024-12-18T23:07:43.120Z","avatar_url":"https://github.com/16patsle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phaser3 Weapon Plugin\n\nA Phaser 3 compatible port of the Weapon Plugin shipped with Phaser CE.\n\nThe plugin is written in TypeScript and uses modern ESNext/ES6+ syntax,\nbut the legacy built version targets ES5.\n\nThis plugin is considered stable and should be mostly feature complete compared\nto the original. If any bugs do occur please help us by reporting them.\n\nThis plugin can be installed from npm:\n\n```bash\nnpm install phaser3-weapon-plugin # if you use npm\nyarn add phaser3-weapon-plugin # for yarn users\n```\n\n**[Version 2 is out, read the announcement post for more information](https://medium.com/@16patsle/announcing-phaser3-weapon-plugin-v2-b662500beebf)**\n\n## Usage\n\nUsage of the plugin should be similar to that of the one included in Phaser CE.\nSee the documentation availabe at [16patsle.github.io/phaser3-weapon-plugin](https://16patsle.github.io/phaser3-weapon-plugin/) or in the `docs/` when built locally.\n\nThere are several ways to load plugins in Phaser 3.\nYou can load plugins externally, or include them in your bundle.\nThese instructions show how to load the default bundle. See the note on the\nalternative bundles below, and when you might want to use them.\n\n### Using a bundler (Webpack, Rollup, Parcel, etc.)\n\nWhen using a bundler, you can just import the package directly. We recommend\nimporting the named export `WeaponPlugin`.\n\n```js\nimport { WeaponPlugin } from 'phaser3-weapon-plugin'\n```\n\nThen you can install it into your scene:\n\n```js\nfunction create () {\n    // Install it into a scene\n    this.plugins.installScenePlugin(\n        'WeaponPlugin',\n        WeaponPlugin,\n        'weapons',\n        this\n    );\n}\n```\n\nThis also works if you for some other reason have access to the plugin class object.\n\n### Using a script tag\n\nTo load an external plugin, you can just use a regular script tag. The global\nvariable WeaponPlugin will then include the various classes, including the\nplugin itself. You can install it in your scene in the following way:\n\n```js\nfunction create () {\n    // Install it into a scene\n    this.plugins.installScenePlugin(\n        'WeaponPlugin',\n        WeaponPlugin.WeaponPlugin,\n        'weapons',\n        this\n    );\n}\n```\n\n### Using Phaser's loader\n\nAlternatively, you can use Phaser's plugin loader:\n\n```js\nfunction preload () {\n    // Load the script\n    this.load.scenePlugin('WeaponPlugin', 'path/to/WeaponPlugin.js', 'weaponPlugin', 'weapons');\n}\n```\n\n## Difference between prebuilt files\n\nVersion 2 of this plugin is distributed in 3 different editions:\nnormal, legacy and modern. In addition, the raw TypeScript is compiled to\nJavaScript, both with some and with no transpilation.\n\n| Name       | Target | Format | Path                                                                       | Recommended for                            |\n|------------|--------|--------|----------------------------------------------------------------------------|--------------------------------------------|\n| Normal     | ES2015 | UMD    | dist/WeaponPlugin.js (main entrypoint) dist/WeaponPlugin.min.js (minified) | Script tag/Phaser loader                   |\n| Legacy     | ES5    | UMD    | dist/WeaponPlugin.legacy.js dist/WeaponPlugin.legacy.min.js (minified)     | Script tag/Phaser loader (legacy support)  |\n| Modern     | ESNext | UMD    | dist/WeaponPlugin.modern.js dist/WeaponPlugin.modern.min.js (minified)     | Script tag/Phaser loader (modern browsers) |\n| TSC-ESNext | ESNext | ESM    | out/esnext/main.js                                                         | Webpack/bundling (support modern browsers) |\n| TSC-ES2016 | ES2016 | ESM    | out/es2016/main.js (module entrypoint)                                     | Webpack/bundling                           |\n| TypeScript | ESNext | TS     | src/main.ts                                                                | Usually not                                |\n\nThe legacy build is transpiled down to ES5, and also\nincludes the required polyfills. The normal build supports all browsers\nsupporting ES modules, and can be used together with the legacy build if you\nwant to leverage the\n[module/nomodule pattern](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/).\nUnless you know you need ES5, using the normal build will probably suffice.\n\nAdditionally there's the modern build, which at the moment is almost the same\nas the normal build. However it targets the last 2 releases of all the major\nbrowsers (Internet Explorer doesn't count as major), and thus only transpiles\na few of the newest language features, giving the smallest bundle size and the\nbest performance. As time goes on, expect this build to diverge further from\nthe normal build.\n\nIn addition to this, the TypeScript source code of the plugin is\navailable, compiled to regular JavaScript in the `out/` directory in case you\nwant to consume it from a bundler. It is available both as untranspiled ESNext\nand transpiled down to ES2016. The latter is what Webpack will use by default.\n\n## Building\n\nRun `npm install` to download dependencies and build.\nTo rebuild you can use `npm run build`.\n\nUse `npm run examples` to run the exampes locally,\nthen visit `localhost:2344` in your browser.\n\n## Linting\n\nTo run Eslint and Prettier, use `npm run lint` (for just linting)\nor `npm run lint:fix` (for fixing). The equivalent scripts for linting the examples\nare `lintexamples` and `lintexamples:fix`.\n\n## Documentation\n\nThe plugin is documented using inline JSDoc/TSDoc comments, which are processed\nby TypeDoc into static documentation pages. You can run the TypeDoc generator\nwith `npm run docs`, which will generate updated docs in the `docs/` folder.\n\nThe documentation is also available at\n[16patsle.github.io/phaser3-weapon-plugin](https://16patsle.github.io/phaser3-weapon-plugin/)\n\n## Credits\n\nThis plugin is a port of the\n[Weapon Plugin](https://github.com/photonstorm/phaser-ce/blob/f2be9bef1d953c9cd55dcd8808d109fa96731126/src/plugins/weapon/WeaponPlugin.js)\nin Phaser CE by Richard Davey, and is based on the Phaser 3 Plugin template,\nalso by Richard Davey\n\nThe port of the plugin was started and is maintained by\n[@16patsle](https://github.com/16patsle), but\n[@jdotrjs](https://github.com/jdotrjs) has helped extensively with debugging\nand by porting several features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F16patsle%2Fphaser3-weapon-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F16patsle%2Fphaser3-weapon-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F16patsle%2Fphaser3-weapon-plugin/lists"}