forked from datawhale/whale-town-front
Merge pull request '修正语法错误' (#11) from qbb0530/whale-town-front:main into main
Reviewed-on: datawhale/whale-town-front#11
This commit is contained in:
58
claude.md
58
claude.md
@@ -2,7 +2,7 @@
|
||||
|
||||
## 1. Project Vision & Context
|
||||
- **Project**: "WhaleTown" - A 2D top-down pixel art RPG.
|
||||
- **Engine**: Godot 4.2+ (Strictly NO Godot 3.x syntax).
|
||||
- **Engine**: Godot 4.5+ (Strictly NO Godot 3.x syntax).
|
||||
- **Architecture**: Strictly layered: `_Core` (Framework), `Scenes` (Gameplay), `UI` (Interface).
|
||||
- **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`.
|
||||
|
||||
@@ -46,36 +46,40 @@
|
||||
const PLAYER_MOVED = "player_moved"
|
||||
const INTERACT_PRESSED = "interact_pressed"
|
||||
const NPC_TALKED = "npc_talked"
|
||||
Singletons: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
|
||||
Decoupling: Low-level entities MUST NOT reference GameManager. Use events.
|
||||
6. 🏗 Implementation Details
|
||||
Player: CharacterBody2D. Must include Camera2D with position_smoothing_enabled = true.
|
||||
NPC/Interactables: Use Area2D named InteractionArea. Trigger via EventSystem.
|
||||
TileMap Layers:
|
||||
Layer 0: Ground (No collision).
|
||||
Layer 1: Obstacles (Physics Layer enabled).
|
||||
Layer 2: Decoration (Y-Sort enabled).
|
||||
Camera: Must auto-calculate limits via TileMap.get_used_rect().
|
||||
7. 🧪 Testing Requirements (MANDATORY)
|
||||
Coverage: Every Manager/System in _Core/ MUST have a GUT test.
|
||||
Naming: Test files must start with test_ and extend GutTest.
|
||||
Example:
|
||||
code
|
||||
Gdscript
|
||||
extends GutTest
|
||||
func test_event_emission():
|
||||
```
|
||||
- **Singletons**: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
|
||||
- **Decoupling**: Low-level entities MUST NOT reference GameManager. Use events.
|
||||
|
||||
## 6. 🏗 Implementation Details
|
||||
- **Player**: CharacterBody2D. Must include Camera2D with `position_smoothing_enabled = true`.
|
||||
- **NPC/Interactables**: Use Area2D named InteractionArea. Trigger via EventSystem.
|
||||
- **TileMap Layers**:
|
||||
- Layer 0: Ground (No collision).
|
||||
- Layer 1: Obstacles (Physics Layer enabled).
|
||||
- Layer 2: Decoration (Y-Sort enabled).
|
||||
- **Camera**: Must auto-calculate limits via `TileMap.get_used_rect()`.
|
||||
|
||||
## 7. 🧪 Testing Requirements (MANDATORY)
|
||||
- **Coverage**: Every Manager/System in `_Core/` MUST have a GUT test.
|
||||
- **Naming**: Test files must start with `test_` and extend GutTest.
|
||||
- **Example**:
|
||||
```gdscript
|
||||
extends GutTest
|
||||
func test_event_emission():
|
||||
var sender = Node.new()
|
||||
watch_signals(EventSystem)
|
||||
EventSystem.emit_event(EventNames.PLAYER_MOVED, {})
|
||||
assert_signal_emitted(EventSystem, "event_raised")
|
||||
8. 🧘 The Zen of Development
|
||||
Juice or Death: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
|
||||
Zero Magic Numbers: All speeds/timers MUST be @export or defined in Config/.
|
||||
Simplicity: If a function does two things, split it.
|
||||
Back of the Fence: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD.
|
||||
9. 📝 Code Template (Entity Pattern)
|
||||
code
|
||||
Gdscript
|
||||
```
|
||||
|
||||
## 8. 🧘 The Zen of Development
|
||||
- **Juice or Death**: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
|
||||
- **Zero Magic Numbers**: All speeds/timers MUST be `@export` or defined in `Config/`.
|
||||
- **Simplicity**: If a function does two things, split it.
|
||||
- **Back of the Fence**: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD.
|
||||
|
||||
## 9. 📝 Code Template (Entity Pattern)
|
||||
```gdscript
|
||||
extends CharacterBody2D
|
||||
class_name Player
|
||||
|
||||
|
||||
Reference in New Issue
Block a user