[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CS3K0EZQ4NF3ASFTZ86MA8":3,"skill-same:01M7CS3K0EZQ4NF3ASFTZ86MA8":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7CS3K0EZQ4NF3ASFTZ86MA8","phaser-pixi-2d-games",null,"Use when building a 2D web game with Phaser (3.x\u002F4.x) or PixiJS 8 in TypeScript - framework vs renderer, Phaser scenes\u002Fgame objects\u002Farcade physics\u002Fgroups as pools\u002Fscale manager\u002Floader, scene shutdown cleanup, PixiJS 8 async init, Assets bundles, ticker units and destroy, and keeping rules in plain TS modules.","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fphaser-pixi-2d-games\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: phaser-pixi-2d-games\ncategory: engine\ndescription: Use when building a 2D web game with Phaser (3.x\u002F4.x) or PixiJS 8 in TypeScript - framework vs renderer, Phaser scenes\u002Fgame objects\u002Farcade physics\u002Fgroups as pools\u002Fscale manager\u002Floader, scene shutdown cleanup, PixiJS 8 async init, Assets bundles, ticker units and destroy, and keeping rules in plain TS modules.\ntech_stack: Web 2D\nsource: informed by the Phaser 3\u002F4 and PixiJS 8 documentation and migration guides; own wording\n---\n# Phaser and PixiJS 2D Games\n\n## Overview\n\nPhaser is a game framework: scenes, game objects, input, physics, audio, tweens, a loader and a scale manager. PixiJS is a fast 2D renderer: display objects, textures and a ticker — scenes, physics, input mapping and audio are yours to add. Pick by what the repository already uses; never put both in one game.\n\n**Core principle:** The engine draws and dispatches; rules live in plain TypeScript modules with no engine import, so Vitest can run them (web-game-performance-and-testing).\n\n## Phaser: structure\n\n```ts\n\u002F\u002F main.ts\nnew Phaser.Game({\n  type: Phaser.AUTO,\n  parent: \"game\",\n  backgroundColor: \"#101018\",\n  scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, width: 1280, height: 720 },\n  physics: { default: \"arcade\", arcade: { gravity: { x: 0, y: 900 }, debug: false } },\n  scene: [BootScene, PreloadScene, GameScene, HudScene],\n});\n```\n\n```ts\n\u002F\u002F GameScene.ts — the scene wires engine objects to plain rules\nexport class GameScene extends Phaser.Scene {\n  private player!: Player;\n  private bullets!: Phaser.Physics.Arcade.Group;\n  private rules!: CombatRules;                       \u002F\u002F plain TS, no Phaser import\n\n  constructor() { super(\"Game\"); }\n\n  create(data: { seed: number }): void {\n    this.rules = new CombatRules(definitions.combat, mulberry32(data.seed ?? Date.now()));\n    this.player = new Player(this, 200, 500);\n    this.bullets = this.physics.add.group({ classType: Bullet, maxSize: 64, runChildUpdate: true });\n    this.physics.add.overlap(this.bullets, this.enemies, (b, e) => this.onHit(b as Bullet, e as Enemy));\n    this.scene.launch(\"Hud\");                        \u002F\u002F HUD as a parallel scene listening to events\n    this.events.once(Phaser.Scenes.Events.SHUTDOWN, () => this.cleanup());\n  }\n\n  update(_time: number, deltaMs: number): void {\n    this.rules.tick(deltaMs \u002F 1000);                  \u002F\u002F Phaser's delta is milliseconds\n    this.player.applyIntent(this.input.keyboard!, deltaMs \u002F 1000);\n  }\n\n  private fire(x: number, y: number): void {\n    const b = this.bullets.get(x, y) as Bullet | null;  \u002F\u002F reuse from the pool; null when maxSize reached\n    b?.launch(600);\n  }\n\n  private cleanup(): void {\n    this.game.events.off(\"settings-changed\", this.applySettings, this);\n  }\n}\n```\n\n- Scenes: Boot (config) → Preload (loader with a progress bar) → gameplay scenes; HUD\u002FUI in a parallel scene (`scene.launch`) talking through events, not object references.\n- Game objects as classes extending `Phaser.GameObjects.Sprite` \u002F `Phaser.Physics.Arcade.Sprite`, added with `scene.add.existing(this)` and `scene.physics.add.existing(this)`.\n- Groups are pools: `maxSize`, `get()`, and on release `setActive(false).setVisible(false)` plus disabling the body (`group.killAndHide(obj)`, `body.enable = false`). Never `new` + `destroy` per shot.\n- Arcade physics steps on its own fixed rate (`arcade.fps`, default 60); move bodies with velocity\u002Facceleration, not by setting `x`\u002F`y` each frame. Matter physics for real shapes and constraints, at higher cost.\n- Listeners registered on `this.game.events`, the registry, or DOM\u002Fwindow must be removed on `SHUTDOWN`; listeners on the scene's own emitter die with it. Restarting a scene that leaked listeners doubles every handler.\n- Loader: texture atlases (`this.load.atlas(key, png, json)`), audio with format alternatives (`this.load.audio(\"hit\", [\"hit.ogg\", \"hit.m4a\"])`), a pack file for large asset lists.\n- Input: map keys to actions once (`this.input.keyboard!.addKeys({ jump: \"SPACE\", left: \"A\", right: \"D\" })`); pointer and touch through the same action layer; gamepads with `input: { gamepad: true }` in the config.\n- Phaser 4 keeps the v3 scene and game-object model with a new renderer; follow the repository's major version and its migration notes rather than mixing APIs.\n\n## PixiJS 8: the renderer\n\n```ts\nconst app = new Application();\nawait app.init({ resizeTo: window, background: \"#101018\", antialias: false });   \u002F\u002F async in v8\ndocument.getElementById(\"game\")!.appendChild(app.canvas);                         \u002F\u002F `canvas`, not `view`\n\nawait Assets.init({ manifest: \"assets\u002Fmanifest.json\" });\nconst level = await Assets.loadBundle(\"level-1\");\n\nconst world = new Container();\napp.stage.addChild(world);\nconst hero = new Sprite(level.hero);\nworld.addChild(hero);\n\napp.ticker.add((ticker) => {\n  const dt = ticker.deltaMS \u002F 1000;            \u002F\u002F seconds; ticker.deltaTime is a frame-scaled factor (~1 at 60 FPS)\n  sim.step(dt);\n  hero.position.set(sim.hero.x, sim.hero.y);\n});\n```\n\n- Version 8 changes that break v7 code: async `app.init`, `app.canvas`, the ticker callback receiving the `Ticker`, the chainable `Graphics` API (`new Graphics().rect(0, 0, 10, 10).fill(0xff0000)`), `ParticleContainer` holding lightweight `Particle`s.\n- Load through `Assets` with bundles per level; unload a level's bundle when leaving it (`Assets.unloadBundle`).\n- `destroy({ children: true })` removes a subtree; pass `texture: true` only for textures nothing else shares.\n- Many identical sprites: one atlas texture so the batcher draws them together; `ParticleContainer` for thousands of particles; `cullable = true` on off-screen-heavy scenes.\n- Pixi has no physics or input mapping: the simulation (accumulator loop, game-loop-and-time) and the action layer are your modules, and the ticker only renders their state.\n\n## Shared rules\n\n- TypeScript `strict`; no `any`, no `as` casts to silence the compiler — type game object factories and event payloads.\n- One source of randomness, seeded (`mulberry32(seed)`), passed into rules; the seed comes from the URL in debug builds so tests and screenshots are reproducible.\n- Text: bitmap fonts for frequently changing numbers (score, timers); `Text` objects regenerate a texture on every change.\n- Pixel art: `pixelArt: true` (Phaser) or `antialias: false` plus nearest scaling (Pixi), integer zoom, and positions rounded at render time.\n- Scale and letterbox to a fixed logical resolution; never size the game from `window.innerWidth` inside rules.\n\n## Common Mistakes\n\n- Treating Phaser's or Pixi's `delta` as seconds.\n- Creating and destroying bullets and particles every frame.\n- Scene restarts that leak listeners on `game.events`.\n- Rules written inside `Scene.update` that Vitest cannot import without a canvas.\n- Pixi v7 code (`app.view`, synchronous `new Application({...})`) pasted into a v8 project.\n\n## Red Flags\n\n- `import Phaser` or `import { Sprite } from \"pixi.js\"` in a file under the rules\u002Flogic folder.\n- `this.add.text` updated every frame for a score counter.\n- A scene with `events.on` on a global emitter and no matching `off`.\n","# Phaser and PixiJS 2D Games\n\n## Overview\n\nPhaser is a game framework: scenes, game objects, input, physics, audio, tweens, a loader and a scale manager. PixiJS is a fast 2D renderer: display objects, textures and a ticker — scenes, physics, input mapping and audio are yours to add. Pick by what the repository already uses; never put both in one game.\n\n**Core principle:** The engine draws and dispatches; rules live in plain TypeScript modules with no engine import, so Vitest can run them (web-game-performance-and-testing).\n\n## Phaser: structure\n\n```ts\n\u002F\u002F main.ts\nnew Phaser.Game({\n  type: Phaser.AUTO,\n  parent: \"game\",\n  backgroundColor: \"#101018\",\n  scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, width: 1280, height: 720 },\n  physics: { default: \"arcade\", arcade: { gravity: { x: 0, y: 900 }, debug: false } },\n  scene: [BootScene, PreloadScene, GameScene, HudScene],\n});\n```\n\n```ts\n\u002F\u002F GameScene.ts — the scene wires engine objects to plain rules\nexport class GameScene extends Phaser.Scene {\n  private player!: Player;\n  private bullets!: Phaser.Physics.Arcade.Group;\n  private rules!: CombatRules;                       \u002F\u002F plain TS, no Phaser import\n\n  constructor() { super(\"Game\"); }\n\n  create(data: { seed: number }): void {\n    this.rules = new CombatRules(definitions.combat, mulberry32(data.seed ?? Date.now()));\n    this.player = new Player(this, 200, 500);\n    this.bullets = this.physics.add.group({ classType: Bullet, maxSize: 64, runChildUpdate: true });\n    this.physics.add.overlap(this.bullets, this.enemies, (b, e) => this.onHit(b as Bullet, e as Enemy));\n    this.scene.launch(\"Hud\");                        \u002F\u002F HUD as a parallel scene listening to events\n    this.events.once(Phaser.Scenes.Events.SHUTDOWN, () => this.cleanup());\n  }\n\n  update(_time: number, deltaMs: number): void {\n    this.rules.tick(deltaMs \u002F 1000);                  \u002F\u002F Phaser's delta is milliseconds\n    this.player.applyIntent(this.input.keyboard!, deltaMs \u002F 1000);\n  }\n\n  private fire(x: number, y: number): void {\n    const b = this.bullets.get(x, y) as Bullet | null;  \u002F\u002F reuse from the pool; null when maxSize reached\n    b?.launch(600);\n  }\n\n  private cleanup(): void {\n    this.game.events.off(\"settings-changed\", this.applySettings, this);\n  }\n}\n```\n\n- Scenes: Boot (config) → Preload (loader with a progress bar) → gameplay scenes; HUD\u002FUI in a parallel scene (`scene.launch`) talking through events, not object references.\n- Game objects as classes extending `Phaser.GameObjects.Sprite` \u002F `Phaser.Physics.Arcade.Sprite`, added with `scene.add.existing(this)` and `scene.physics.add.existing(this)`.\n- Groups are pools: `maxSize`, `get()`, and on release `setActive(false).setVisible(false)` plus disabling the body (`group.killAndHide(obj)`, `body.enable = false`). Never `new` + `destroy` per shot.\n- Arcade physics steps on its own fixed rate (`arcade.fps`, default 60); move bodies with velocity\u002Facceleration, not by setting `x`\u002F`y` each frame. Matter physics for real shapes and constraints, at higher cost.\n- Listeners registered on `this.game.events`, the registry, or DOM\u002Fwindow must be removed on `SHUTDOWN`; listeners on the scene's own emitter die with it. Restarting a scene that leaked listeners doubles every handler.\n- Loader: texture atlases (`this.load.atlas(key, png, json)`), audio with format alternatives (`this.load.audio(\"hit\", [\"hit.ogg\", \"hit.m4a\"])`), a pack file for large asset lists.\n- Input: map keys to actions once (`this.input.keyboard!.addKeys({ jump: \"SPACE\", left: \"A\", right: \"D\" })`); pointer and touch through the same action layer; gamepads with `input: { gamepad: true }` in the config.\n- Phaser 4 keeps the v3 scene and game-object model with a new renderer; follow the repository's major version and its migration notes rather than mixing APIs.\n\n## PixiJS 8: the renderer\n\n```ts\nconst app = new Application();\nawait app.init({ resizeTo: window, background: \"#101018\", antialias: false });   \u002F\u002F async in v8\ndocument.getElementById(\"game\")!.appendChild(app.canvas);                         \u002F\u002F `canvas`, not `view`\n\nawait Assets.init({ manifest: \"assets\u002Fmanifest.json\" });\nconst level = await Assets.loadBundle(\"level-1\");\n\nconst world = new Container();\napp.stage.addChild(world);\nconst hero = new Sprite(level.hero);\nworld.addChild(hero);\n\napp.ticker.add((ticker) => {\n  const dt = ticker.deltaMS \u002F 1000;            \u002F\u002F seconds; ticker.deltaTime is a frame-scaled factor (~1 at 60 FPS)\n  sim.step(dt);\n  hero.position.set(sim.hero.x, sim.hero.y);\n});\n```\n\n- Version 8 changes that break v7 code: async `app.init`, `app.canvas`, the ticker callback receiving the `Ticker`, the chainable `Graphics` API (`new Graphics().rect(0, 0, 10, 10).fill(0xff0000)`), `ParticleContainer` holding lightweight `Particle`s.\n- Load through `Assets` with bundles per level; unload a level's bundle when leaving it (`Assets.unloadBundle`).\n- `destroy({ children: true })` removes a subtree; pass `texture: true` only for textures nothing else shares.\n- Many identical sprites: one atlas texture so the batcher draws them together; `ParticleContainer` for thousands of particles; `cullable = true` on off-screen-heavy scenes.\n- Pixi has no physics or input mapping: the simulation (accumulator loop, game-loop-and-time) and the action layer are your modules, and the ticker only renders their state.\n\n## Shared rules\n\n- TypeScript `strict`; no `any`, no `as` casts to silence the compiler — type game object factories and event payloads.\n- One source of randomness, seeded (`mulberry32(seed)`), passed into rules; the seed comes from the URL in debug builds so tests and screenshots are reproducible.\n- Text: bitmap fonts for frequently changing numbers (score, timers); `Text` objects regenerate a texture on every change.\n- Pixel art: `pixelArt: true` (Phaser) or `antialias: false` plus nearest scaling (Pixi), integer zoom, and positions rounded at render time.\n- Scale and letterbox to a fixed logical resolution; never size the game from `window.innerWidth` inside rules.\n\n## Common Mistakes\n\n- Treating Phaser's or Pixi's `delta` as seconds.\n- Creating and destroying bullets and particles every frame.\n- Scene restarts that leak listeners on `game.events`.\n- Rules written inside `Scene.update` that Vitest cannot import without a canvas.\n- Pixi v7 code (`app.view`, synchronous `new Application({...})`) pasted into a v8 project.\n\n## Red Flags\n\n- `import Phaser` or `import { Sprite } from \"pixi.js\"` in a file under the rules\u002Flogic folder.\n- `this.add.text` updated every frame for a score counter.\n- A scene with `events.on` on a global emitter and no matching `off`.\n",{"name":5,"source":24,"category":25,"tech_stack":26,"description":7},"informed by the Phaser 3\u002F4 and PixiJS 8 documentation and migration guides; own wording","engine","Web 2D","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fphaser-pixi-2d-games",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill phaser-pixi-2d-games",{"tool":42,"command":43},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill phaser-pixi-2d-games",{"tool":45,"command":46},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill phaser-pixi-2d-games","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fphaser-pixi-2d-games\u002FSKILL.md",true,[],[51,57,64,71,78,85],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]