add-feature

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Add Feature

添加功能

Add a new feature to your game. Just describe what you want in plain English — for example, "add a double-jump power-up" or "add a high score leaderboard" — and the feature will be built following your game's existing patterns.
为你的游戏添加新功能。只需用简单的英语描述你的需求——例如“添加二段跳强化道具”或“添加高分排行榜”——功能将遵循游戏现有的模式进行开发。

Instructions

操作说明

The user wants to add: $ARGUMENTS
用户想要添加:$ARGUMENTS

Step 1: Understand the codebase

步骤1:了解代码库

  • Read
    package.json
    to identify the engine (Three.js or Phaser)
  • Read
    src/core/Constants.js
    for existing configuration
  • Read
    src/core/EventBus.js
    for existing events
  • Read
    src/core/GameState.js
    for existing state
  • Read
    src/core/Game.js
    (or GameConfig.js) for existing system wiring
  • Read existing scene and gameplay files to understand what's already built
  • 阅读
    package.json
    以确定使用的引擎(Three.js或Phaser)
  • 阅读
    src/core/Constants.js
    了解现有配置
  • 阅读
    src/core/EventBus.js
    了解现有事件
  • 阅读
    src/core/GameState.js
    了解现有状态
  • 阅读
    src/core/Game.js
    (或GameConfig.js)了解现有系统的连接方式
  • 阅读现有的场景和玩法文件,了解已开发的内容

Step 2: Plan the feature

步骤2:规划功能

Before writing code, explain the plan in plain English:
  1. What it does: Describe the feature from the player's perspective
  2. How it works: List the new files, events, and settings that will be created
  3. What it touches: List existing files that need small changes to wire in the feature
Then determine what's needed technically:
  • New module file(s) and where they go in the directory structure
  • New events to add to the Events enum
  • New constants to add to Constants.js
  • New state to add to GameState.js
  • How to wire it into the Game orchestrator
在编写代码之前,用简单的英语说明规划:
  1. 功能作用:从玩家的角度描述该功能
  2. 实现方式:列出将要创建的新文件、事件和设置
  3. 涉及范围:列出为了接入该功能需要进行小幅修改的现有文件
然后确定技术层面的需求:
  • 新的模块文件及其在目录结构中的位置
  • 需要添加到Events枚举中的新事件
  • 需要添加到Constants.js中的新常量
  • 需要添加到GameState.js中的新状态
  • 如何将其接入Game协调器

Step 3: Implement

步骤3:实现

Follow these rules strictly:
  1. Create the new module in the correct
    src/
    subdirectory
  2. Add ALL new events to
    EventBus.js
    Events enum
  3. Add ALL configuration values to
    Constants.js
    (zero hardcoded values)
  4. Add any new state domains to
    GameState.js
  5. Wire the new system into
    Game.js
    (import, instantiate, update in loop)
  6. Use EventBus for ALL communication with other systems
  7. Follow the existing code style and patterns in the project
严格遵循以下规则:
  1. 在正确的
    src/
    子目录中创建新模块
  2. 将所有新事件添加到
    EventBus.js
    的Events枚举中
  3. 将所有配置值添加到
    Constants.js
    中(禁止硬编码值)
  4. 将所有新的状态域添加到
    GameState.js
  5. 将新系统接入
    Game.js
    (导入、实例化、在循环中更新)
  6. 与其他系统的所有通信均使用EventBus
  7. 遵循项目中现有的代码风格和模式

Step 4: Verify

步骤4:验证

  • Run
    npm run build
    to confirm no errors
  • Confirm the feature integrates without breaking existing systems
  • Check that no circular dependencies were introduced
  • Ensure event listeners are properly cleaned up if applicable
  • Summarize what was added in plain English
  • 运行
    npm run build
    确认无错误
  • 确认功能集成后不会破坏现有系统
  • 检查是否引入了循环依赖
  • 确保事件监听器在适用时被正确清理
  • 用简单的英语总结所添加的内容

Output

输出内容

Tell the user:
  1. What the feature does (from the player's perspective)
  2. What files were created or changed
  3. How to test it — "Run
    npm run dev
    and try [specific action]"
告知用户:
  1. 功能作用(从玩家角度出发)
  2. 创建或修改了哪些文件
  3. 如何测试——“运行
    npm run dev
    并尝试[具体操作]”

Tips

提示

You can run this command as many times as you want to keep adding features. Each one builds on the last.
When you're happy with the gameplay, run
/game-creator:design-game
to polish the visuals,
/game-creator:add-audio
for music and sound effects, or
/game-creator:review-game
for a full quality check.
你可以多次运行此命令以持续添加功能,每个新功能都会基于之前的内容构建。
当你对玩法满意后,运行
/game-creator:design-game
优化视觉效果,运行
/game-creator:add-audio
添加音乐和音效,或运行
/game-creator:review-game
进行全面质量检查。