Phase 0: Project setup for agent-driven development
- Phaser 3 + bitECS 0.4 + TypeScript + Vite stack - BootScene with title screen - 6 cursor rules (project context, agent workflow, ECS, chemistry, Phaser, data) - Vitest configured with happy-dom - GDD, engine analysis, implementation plan, progress tracking Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
44
.cursor/rules/phaser-scenes.mdc
Normal file
44
.cursor/rules/phaser-scenes.mdc
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
description: Phaser scene lifecycle and conventions
|
||||
globs: src/scenes/**/*.ts
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Phaser Scene Conventions
|
||||
|
||||
## Lifecycle
|
||||
```
|
||||
constructor → init(data) → preload() → create() → update(time, delta)
|
||||
```
|
||||
- `init`: receive data from scene transitions
|
||||
- `preload`: load assets (prefer doing this only in BootScene)
|
||||
- `create`: set up game objects, physics, input, cameras
|
||||
- `update`: run ECS systems, sync bridge
|
||||
|
||||
## Scene Structure
|
||||
```typescript
|
||||
export class GameScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'GameScene' });
|
||||
}
|
||||
|
||||
create(): void {
|
||||
// 1. Initialize ECS world
|
||||
// 2. Create tilemap
|
||||
// 3. Spawn entities
|
||||
// 4. Set up camera
|
||||
// 5. Launch UI overlay
|
||||
this.scene.launch('UIScene');
|
||||
}
|
||||
|
||||
update(time: number, delta: number): void {
|
||||
// Run ECS systems in defined order
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Rules
|
||||
- Full transition: `this.scene.start('Name', { data })`
|
||||
- Overlay: `this.scene.launch('Name')` (for HUD, menus)
|
||||
- Never put game logic in scenes — delegate to ECS systems
|
||||
- Scenes manage Phaser objects; ECS manages game state
|
||||
Reference in New Issue
Block a user