{"id":14964084,"url":"https://github.com/brsullivan/phaser3-angular8","last_synced_at":"2025-09-30T19:30:49.478Z","repository":{"id":38694348,"uuid":"209618069","full_name":"brsullivan/phaser3-angular8","owner":"brsullivan","description":"A boilerplate for integrating Phaser3 into an Angular8 project","archived":false,"fork":false,"pushed_at":"2023-01-07T09:53:13.000Z","size":2678,"stargazers_count":15,"open_issues_count":23,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T05:06:22.702Z","etag":null,"topics":["angular","angular8","html5-game","phaser","phaser3","phaserjs"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brsullivan.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-09-19T18:03:49.000Z","updated_at":"2024-05-29T11:19:59.000Z","dependencies_parsed_at":"2023-02-06T20:30:42.553Z","dependency_job_id":null,"html_url":"https://github.com/brsullivan/phaser3-angular8","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brsullivan/phaser3-angular8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brsullivan%2Fphaser3-angular8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brsullivan%2Fphaser3-angular8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brsullivan%2Fphaser3-angular8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brsullivan%2Fphaser3-angular8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brsullivan","download_url":"https://codeload.github.com/brsullivan/phaser3-angular8/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brsullivan%2Fphaser3-angular8/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277746955,"owners_count":25870057,"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","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["angular","angular8","html5-game","phaser","phaser3","phaserjs"],"created_at":"2024-09-24T13:32:33.610Z","updated_at":"2025-09-30T19:30:49.039Z","avatar_url":"https://github.com/brsullivan.png","language":"TypeScript","readme":"# Phaser 3 \u0026 Angular 8\n\n## Steps to Setup\n1. Create a new angular project with Angular CLI. Add routing (if you want) and your choice of stylesheet format\n```\n  ng new phaser-angular\n```\n\n2. CD into new angular project folder and install Phaser\n```\n  npm i --save phaser\n```\n\n3. Copy `phaser.d.ts` from `/node_modules/phaser/types/` and place it in your project folder.  \n4. Copy `phaser.min.js` from `/node_modules/phaser/dist/` and place it in your project's `src/assets/` folder.\n5. Add reference to the `phaser.min.js` file in your `index.html`.\n```\n  \u003chead\u003e\n    ...\n    \u003cscript src=\"assets/phaser.min.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n```\n\n6. Also, add a fallback script to catch an undefined `global` that Phaser requires.\n```\n  \u003cscript\u003e\n    if (global === undefined) {\n      var global = window;\n    }\n  \u003c/script\u003e\n```\n\n7. In your component.ts file, add import for Phaser.\n```\n  import Phaser from 'phaser';\n```\n* TypeScript will throw an error: This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag\n* In `tsconfig.json`, add 'allowSyntehticDefaultImports': true\n* Also in `tsconfig.json`, update your `libs` arry to include `scripthost`\n```\n  \"lib\": [\n    \"es2018\",\n    \"dom\",\n    \"scripthost\"\n  ]\n```\n\n8. Define your game configuration and initialize\n```\nclass NewScene extends Phaser.Scene {\n\n  constructor() {\n    super({ key: 'new' });\n  }\n\n  preload() {\n    console.log('enter preload');\n  }\n\n  create() {\n    console.log('enter create');\n  }\n}\n\n\n@Component({\n  selector: 'app-sample',\n  templateUrl: './sample.component.html',\n  styleUrls: ['./sample.component.scss']\n})\nexport class SampleComponent implements OnInit {\n\n  phaserGame: Phaser.Game;\n  config: Phaser.Types.Core.GameConfig;\n\n  constructor() {\n    this.config = {\n      type: Phaser.AUTO,\n      scene: [ NewScene ],\n      physics: {\n        default: 'arcade',\n      },\n      scale: {\n        mode: Phaser.Scale.FIT,\n        parent: 'gameContainer',\n        width: 800,\n        height: 600\n      }\n    };\n  }\n\n  ngOnInit() {\n    this.phaserGame = new Phaser.Game(this.config);\n  }\n\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrsullivan%2Fphaser3-angular8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrsullivan%2Fphaser3-angular8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrsullivan%2Fphaser3-angular8/lists"}