phaser-coder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePhaser 4 Coder
Phaser 4 代码编写工具
Use this skill for TypeScript-first Phaser 4 implementation work.
此技能适用于以TypeScript优先的Phaser 4实现工作。
Workflow
工作流程
- Read existing code before editing. Inspect , scene files, related objects/managers, shared constants, and asset keys.
src/main.ts - Match existing naming, folder structure, scene key conventions, and state management patterns.
- Use Phaser 4 APIs only. Avoid removed Phaser 3 APIs such as ,
Phaser.Geom.Point,Phaser.Math.PI2, and deprecated texture generation patterns.Phaser.Structs - Prefer typed constants/enums for scene keys, registry keys, event names, asset keys, and animation keys.
- Write complete runnable code. Avoid placeholder TODOs unless the user explicitly asks for a scaffold.
- After non-trivial edits, run when the project has TypeScript configured.
npx tsc --noEmit
- 编辑前先阅读现有代码。检查、场景文件、相关对象/管理器、共享常量以及资源键。
src/main.ts - 匹配现有的命名规则、文件夹结构、场景键约定和状态管理模式。
- 仅使用Phaser 4 API。避免使用已移除的Phaser 3 API,例如、
Phaser.Geom.Point、Phaser.Math.PI2以及已弃用的纹理生成模式。Phaser.Structs - 优先为场景键、注册表键、事件名称、资源键和动画键使用类型化常量/枚举。
- 编写完整可运行的代码。除非用户明确要求框架代码,否则避免使用占位符TODO。
- 进行非琐碎编辑后,如果项目配置了TypeScript,运行。
npx tsc --noEmit
Implementation Defaults
实现默认规则
- Use class-based scenes extending .
Phaser.Scene - Use Arcade Physics for typical platformer/top-down/shooter mechanics unless Matter.js is clearly required.
- Use object pooling for bullets, enemies, particles, and frequent temporary objects.
- Put shared types under and reusable game objects under
src/types/or the existing local equivalent.src/objects/ - Gate debug affordances behind development mode where possible.
- Keep Vite and Phaser setup compatible with browser runtime and strict TypeScript.
- 使用继承自的基于类的场景。
Phaser.Scene - 除非明确需要Matter.js,否则为典型的平台游戏/俯视角游戏/射击游戏机制使用Arcade Physics。
- 对子弹、敌人、粒子和频繁创建的临时对象使用对象池。
- 将共享类型放在下,可复用游戏对象放在
src/types/或现有本地等效目录中。src/objects/ - 尽可能将调试功能限制在开发模式下。
- 保持Vite和Phaser的设置与浏览器运行时和严格TypeScript兼容。
Full Guidance
完整指南
For the complete coding playbook, read . It is copied from the Claude subagent definition but should be applied as a portable skill; ignore Claude-only fields such as , , and .
references/agent-guidance.mdmodelcolortools如需完整的编码手册,请阅读。该手册复制自Claude子代理定义,但应作为可移植技能使用;忽略仅适用于Claude的字段,例如、和。
references/agent-guidance.mdmodelcolortools