create gem grid

This commit is contained in:
2025-09-23 22:40:00 +04:00
parent cbf6d0e075
commit de68edb1b0
12 changed files with 640 additions and 79 deletions

View File

@@ -4,38 +4,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
"Skelly" is a Godot 4.4 mobile game project that features a match-3 puzzle game within a broader game framework. The project includes a menu system, settings management, audio handling, and localization support.
"Skelly" is a Godot 4.4 mobile game project featuring a match-3 puzzle game within a broader game framework. The project includes a menu system, settings management, audio handling, localization support, and a comprehensive debug system.
## Project Structure
### Core Architecture
- **Autoloaded Singletons**: The project uses four global singletons (autoloads) defined in `project.godot`:
- `SettingsManager` - Handles game settings and configuration
- `AudioManager` - Manages music and sound effects with volume controls
- `GameManager` - Handles scene transitions and game state
- `LocalizationManager` - Manages multi-language support (English/Russian)
### Directory Structure
- `scripts/` - Global singleton scripts and utility classes
- `scenes/` - Game scenes including main game and match-3 components
- `match3/` - Specialized match-3 game implementation
- `ui/` - User interface scenes (MainMenu, SettingsMenu, PressAnyKeyScreen)
- `audio/` - Music and sound effect files
- `resources/` - Game assets (textures, sprites, animations)
- `localization/` - Translation files for internationalization
### Scene Management Flow
1. Main entry point: `scenes/main.tscn` with press-any-key screen
2. Menu navigation: MainMenu → SettingsMenu (with back navigation)
3. Game flow: MainMenu → Game scene → Match3 game integration
4. All scene transitions handled through `GameManager` singleton
### Match-3 Game System
- Located in `scenes/match3/`
- Grid-based (8x8) tile matching system
- Implements match detection, tile dropping, and grid refilling
- Uses tile instances with position-based grid management
- Automatic cascade matching after tile drops
**For detailed project architecture, see `docs/MAP.md`**
## Development Commands
@@ -43,44 +14,69 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- Open project in Godot Editor: Import `project.godot`
- Run project: Press F5 in Godot Editor or use "Play" button
- Debug: Use Godot's built-in debugger and remote inspector
- Debug UI: Press F12 in-game or use debug button to toggle debug panels
### Testing & Development
- Debug mode can be toggled with F12 key or debug button UI
- Match-3 debug controls include gem count adjustment and board reroll
- Difficulty presets: Easy (3 gems), Normal (5 gems), Hard (8 gems)
### Audio Configuration
- Music: Located in `audio/` directory with loop configuration in AudioManager
- Music: Located in `assets/audio/music/` directory with loop configuration in AudioManager
- Sound effects: UI clicks and game audio managed through audio bus system
- Audio buses: "Music" and "SFX" buses configured in `default_bus_layout.tres`
- Audio buses: "Music" and "SFX" buses configured in `data/default_bus_layout.tres`
### Localization
- Translations stored in `localization/` as `.translation` files
- Currently supports English and Russian
- New translations: Add to `project.godot` internationalization section
## Key Components
## Key Development Guidelines
### AudioManager (`scripts/AudioManager.gd`)
- Handles background music with looping
- Manages UI sound effects (click sounds)
- Volume control integration with SettingsManager
- Automatic audio bus configuration
### Scene Management
- **ALWAYS** use `GameManager` for scene transitions - never call `get_tree().change_scene_to_file()` directly
- Scene paths are defined as constants in GameManager
- Error handling is built into GameManager for failed scene loads
### Match3 Game (`scenes/match3/match3.gd`)
- 8x8 grid system with 5 tile types
- Match detection in horizontal and vertical directions
- Tile dropping physics with position-based movement
- Recursive match clearing and grid refilling
### Autoload Usage
- Use autoloads for global state management only
- Prefer signals over direct access for loose coupling
- Don't access autoloads from deeply nested components
### Scene Navigation
- All scene changes go through GameManager for consistency
- Scene paths defined as constants in GameManager
- Error handling for failed scene loads
### Debug System Integration
- Connect to `DebugManager.debug_ui_toggled` signal for debug UI visibility
- Use F12 key for global debug toggle
- Remove debug prints before committing unless permanently useful
## Input System
- Custom input actions defined in `project.godot`:
- `ui_pause` - Space key or gamepad button
- `any_key` - Multiple inputs for menu progression
- `ui_menu_toggle` - Escape key or gamepad button
## Important File References
## Asset Attribution
Asset sources documented in `sources.yaml` including:
- Music from Clement Panchout
- Sound effects from Freesound
- Sprites and textures from various itch.io creators
### Documentation Structure
- **`docs/MAP.md`** - Complete project architecture and structure
- **`docs/CODE_OF_CONDUCT.md`** - Coding standards and best practices
- **This file** - Claude Code specific development guidelines
### Key Scripts to Understand
- `src/autoloads/GameManager.gd` - Scene transition patterns
- `src/autoloads/DebugManager.gd` - Debug system integration
- `scenes/match3/match3.gd` - Match-3 implementation reference
- `project.godot` - Input actions and autoload definitions
## Development Workflow
### Before Making Changes
1. Check `docs/MAP.md` for architecture understanding
2. Review `docs/CODE_OF_CONDUCT.md` for coding standards
3. Understand existing patterns before implementing new features
### Testing Changes
- Run project with F5 in Godot Editor
- Test debug UI with F12 toggle
- Verify scene transitions work correctly
- Check mobile compatibility if UI changes made
### Common Implementation Patterns
- Scene transitions: Use `GameManager.change_to_scene()` methods
- Debug integration: Connect to `DebugManager` signals
- Settings: Use `SettingsManager` for persistent configuration
- Audio: Use `AudioManager` for music and sound effects
- Localization: Use `LocalizationManager` for language switching