add-feature
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdd 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 to identify the engine (Three.js or Phaser)
package.json - Read for existing configuration
src/core/Constants.js - Read for existing events
src/core/EventBus.js - Read for existing state
src/core/GameState.js - Read (or GameConfig.js) for existing system wiring
src/core/Game.js - Read existing scene and gameplay files to understand what's already built
- 阅读以确定使用的引擎(Three.js或Phaser)
package.json - 阅读了解现有配置
src/core/Constants.js - 阅读了解现有事件
src/core/EventBus.js - 阅读了解现有状态
src/core/GameState.js - 阅读(或GameConfig.js)了解现有系统的连接方式
src/core/Game.js - 阅读现有的场景和玩法文件,了解已开发的内容
Step 2: Plan the feature
步骤2:规划功能
Before writing code, explain the plan in plain English:
- What it does: Describe the feature from the player's perspective
- How it works: List the new files, events, and settings that will be created
- 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
在编写代码之前,用简单的英语说明规划:
- 功能作用:从玩家的角度描述该功能
- 实现方式:列出将要创建的新文件、事件和设置
- 涉及范围:列出为了接入该功能需要进行小幅修改的现有文件
然后确定技术层面的需求:
- 新的模块文件及其在目录结构中的位置
- 需要添加到Events枚举中的新事件
- 需要添加到Constants.js中的新常量
- 需要添加到GameState.js中的新状态
- 如何将其接入Game协调器
Step 3: Implement
步骤3:实现
Follow these rules strictly:
- Create the new module in the correct subdirectory
src/ - Add ALL new events to Events enum
EventBus.js - Add ALL configuration values to (zero hardcoded values)
Constants.js - Add any new state domains to
GameState.js - Wire the new system into (import, instantiate, update in loop)
Game.js - Use EventBus for ALL communication with other systems
- Follow the existing code style and patterns in the project
严格遵循以下规则:
- 在正确的子目录中创建新模块
src/ - 将所有新事件添加到的Events枚举中
EventBus.js - 将所有配置值添加到中(禁止硬编码值)
Constants.js - 将所有新的状态域添加到中
GameState.js - 将新系统接入(导入、实例化、在循环中更新)
Game.js - 与其他系统的所有通信均使用EventBus
- 遵循项目中现有的代码风格和模式
Step 4: Verify
步骤4:验证
- Run to confirm no errors
npm run build - 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:
- What the feature does (from the player's perspective)
- What files were created or changed
- How to test it — "Run and try [specific action]"
npm run dev
告知用户:
- 功能作用(从玩家角度出发)
- 创建或修改了哪些文件
- 如何测试——“运行并尝试[具体操作]”
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, runto polish the visuals,/game-creator:design-gamefor music and sound effects, or/game-creator:add-audiofor a full quality check./game-creator:review-game
你可以多次运行此命令以持续添加功能,每个新功能都会基于之前的内容构建。当你对玩法满意后,运行优化视觉效果,运行/game-creator:design-game添加音乐和音效,或运行/game-creator:add-audio进行全面质量检查。/game-creator:review-game