phaser-coder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Phaser 4 Coder

Phaser 4 代码编写工具

Use this skill for TypeScript-first Phaser 4 implementation work.
此技能适用于以TypeScript优先的Phaser 4实现工作。

Workflow

工作流程

  1. Read existing code before editing. Inspect
    src/main.ts
    , scene files, related objects/managers, shared constants, and asset keys.
  2. Match existing naming, folder structure, scene key conventions, and state management patterns.
  3. Use Phaser 4 APIs only. Avoid removed Phaser 3 APIs such as
    Phaser.Geom.Point
    ,
    Phaser.Math.PI2
    ,
    Phaser.Structs
    , and deprecated texture generation patterns.
  4. Prefer typed constants/enums for scene keys, registry keys, event names, asset keys, and animation keys.
  5. Write complete runnable code. Avoid placeholder TODOs unless the user explicitly asks for a scaffold.
  6. After non-trivial edits, run
    npx tsc --noEmit
    when the project has TypeScript configured.
  1. 编辑前先阅读现有代码。检查
    src/main.ts
    、场景文件、相关对象/管理器、共享常量以及资源键。
  2. 匹配现有的命名规则、文件夹结构、场景键约定和状态管理模式。
  3. 仅使用Phaser 4 API。避免使用已移除的Phaser 3 API,例如
    Phaser.Geom.Point
    Phaser.Math.PI2
    Phaser.Structs
    以及已弃用的纹理生成模式。
  4. 优先为场景键、注册表键、事件名称、资源键和动画键使用类型化常量/枚举。
  5. 编写完整可运行的代码。除非用户明确要求框架代码,否则避免使用占位符TODO。
  6. 进行非琐碎编辑后,如果项目配置了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
    src/types/
    and reusable game objects under
    src/objects/
    or the existing local equivalent.
  • 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
references/agent-guidance.md
. It is copied from the Claude subagent definition but should be applied as a portable skill; ignore Claude-only fields such as
model
,
color
, and
tools
.
如需完整的编码手册,请阅读
references/agent-guidance.md
。该手册复制自Claude子代理定义,但应作为可移植技能使用;忽略仅适用于Claude的字段,例如
model
color
tools