This skill integrates Cocos Creator for AI development, aimed at developers looking to leverage AI in game design. It simplifies the implementation of AI features within the Cocos Creator framework.
$ npx skills add https://github.com/zpqq132555/skills --skill cocos-creator-3x-cncocos-creator-3x-cn is a localized skill directory that provides Chinese-language development guidance for Cocos Creator 3.x projects. It's stored in a fixed directory structure that integrates with AI coding assistants like Claude and Codex, allowing developers to maintain consistent framework practices across multiple projects and machines. The skill helps bridge the gap between engine-specific workflows and AI-assisted development by centralizing project rules and technical guidelines. Developers can quickly restore their skill directory on new computers or share standardized practices across different AI tools, eliminating the need to re-document Cocos Creator conventions for each project.
Install the skill using the provided command in your terminal.
Integrate AI behaviors in Cocos Creator games
Automate game testing with AI capabilities
Enhance user experience using AI-driven game mechanics
$ npx skills add https://github.com/zpqq132555/skills --skill cocos-creator-3x-cngit clone https://github.com/zpqq132555/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as an expert Cocos Creator 3.x developer and explain how to integrate AI features into [COMPANY]'s [INDUSTRY] game using the cocos-creator-3x-cn skill. Focus on [SPECIFIC_FEATURE, e.g., NPC behavior, procedural generation, or adaptive difficulty]. Provide code snippets or configuration steps where applicable. The game uses [TECHNOLOGY_STACK, e.g., TypeScript, JavaScript, or Cocos Creator's built-in systems].
# Integrating AI NPCs in Cocos Creator 3.x for [COMPANY]'s Mobile RPG
Here’s how to implement an AI-driven enemy NPC in your Cocos Creator 3.x project:
## Step 1: Set Up the AI Component
Add the `AIController` script to your NPC node. This script will handle decision-making logic. Example:
```typescript
import { _decorator, Component, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('AIController')
export class AIController extends Component {
@property(Node)
playerNode: Node = null;
private speed: number = 2;
private detectionRadius: number = 5;
update(deltaTime: number) {
const npcPos = this.node.worldPosition;
const playerPos = this.playerNode.worldPosition;
const distance = Vec3.distance(npcPos, playerPos);
if (distance < this.detectionRadius) {
this.moveTowardPlayer(playerPos);
}
}
moveTowardPlayer(targetPos: Vec3) {
const direction = new Vec3();
Vec3.subtract(direction, targetPos, this.node.worldPosition);
direction.normalize();
this.node.setWorldPosition(
this.node.worldPosition.x + direction.x * this.speed * deltaTime,
this.node.worldPosition.y,
this.node.worldPosition.z + direction.z * this.speed * deltaTime
);
}
}
```
## Step 2: Configure the AI Behavior
In the Cocos Creator Inspector, assign the `playerNode` reference to your player’s root node. Adjust `speed` and `detectionRadius` to balance difficulty.
## Step 3: Test in Game
Run the game and verify the NPC chases the player when within range. For advanced behaviors (e.g., patrolling or attacking), extend the `AIController` class with state machines or pathfinding logic.
### Next Steps
- Use Cocos Creator’s **Animation** system to trigger attack animations when the NPC is close.
- Integrate **spine animations** for smoother movement transitions.
- For procedural enemy spawns, explore Cocos Creator’s **TileMap** or **ParticleSystem** for dynamic level design.
Need help optimizing performance? Share your project structure, and I’ll suggest optimizations for large-scale AI systems!Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan