add basic match3 logic

use proper logging everywhere
add gamepad and keyboard control on match3 gameplay
This commit is contained in:
2025-09-24 16:58:08 +04:00
parent e76297b3f3
commit bbf512b675
14 changed files with 466 additions and 63 deletions

View File

@@ -21,6 +21,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- Match-3 debug controls include gem count adjustment and board reroll
- Difficulty presets: Easy (3 gems), Normal (5 gems), Hard (8 gems)
- Gameplay mode switching: Space+Enter in game scene switches between match-3 and clickomania modes
- **Match-3 Gem Movement Testing**:
- Keyboard: Arrow keys or WASD to navigate, Enter to select/confirm
- Gamepad: D-pad to navigate, A button to select/confirm
- Visual feedback: Selected tiles glow brighter with scale and color effects
- Invalid swaps automatically revert after animation
- State machine: WAITING → SELECTING → SWAPPING → PROCESSING
- Test scripts located in `tests/` directory for system validation
- Use `test_logging.gd` to validate the logging system functionality
@@ -60,11 +66,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- Remove debug prints before committing unless permanently useful
### Logging System Usage
- **CRITICAL**: ALL print() and push_error() statements have been migrated to DebugManager
- **ALWAYS** use `DebugManager` logging functions instead of `print()`, `push_error()`, etc.
- Use appropriate log levels: INFO for general messages, WARN for issues, ERROR for failures
- Include meaningful categories to organize log output: `"GameManager"`, `"Match3"`, `"Settings"`
- Include meaningful categories to organize log output: `"GameManager"`, `"Match3"`, `"Settings"`, `"Game"`, `"MainMenu"`, `"PressAnyKey"`, `"Clickomania"`, `"DebugMenu"`
- Leverage structured logging for better debugging and production monitoring
- Use `DebugManager.set_log_level()` to control verbosity during development and testing
- The logging system provides unified output across all game systems
## Important File References
@@ -78,9 +86,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- `src/autoloads/GameManager.gd` - Scene transition patterns and gameplay mode management
- `src/autoloads/DebugManager.gd` - Debug system integration
- `scenes/game/game.gd` - Main game scene with modular gameplay system
- `scenes/game/gameplays/match3_gameplay.gd` - Match-3 implementation reference
- `scenes/game/gameplays/match3_gameplay.gd` - Match-3 implementation with keyboard/gamepad gem movement system
- `scenes/game/gameplays/tile.gd` - Individual tile behavior with visual feedback and input handling
- `scenes/game/gameplays/` - Individual gameplay mode implementations
- `project.godot` - Input actions and autoload definitions
- Gem movement actions: `select_gem`, `move_up/down/left/right`
## Development Workflow

View File

@@ -133,12 +133,23 @@ The game now uses a modular gameplay architecture where different game modes can
- Gem pool management (3-8 gem types)
- Debug UI integration
- Score reporting via `score_changed` signal
- **Gem Movement System**: Keyboard and gamepad input for tile selection and swapping
- State machine: WAITING → SELECTING → SWAPPING → PROCESSING
- Adjacent tile validation (horizontal/vertical neighbors only)
- Match validation (swaps must create matches or revert)
- Smooth tile position animations with Tween
- Cursor-based navigation with visual highlighting
2. **Tile System** (`scenes/game/gameplays/tile.gd` + `Tile.tscn`)
- Individual tile behavior
- Gem type management
- Visual representation
- Visual representation with scaling and color modulation
- Group membership for coordination
- **Visual Feedback System**: Multi-state display for game interaction
- Selection visual feedback (scale and color modulation)
- State management (normal, highlighted, selected)
- Signal-based communication with gameplay controller
- Smooth animations with Tween system
#### Clickomania Mode (`scenes/game/gameplays/clickomania_gameplay.tscn`)
- Planned implementation for clickomania-style gameplay
@@ -233,6 +244,9 @@ sprites:
- `project.godot` - Main Godot project settings
- Autoload definitions
- Input map configurations
- **Gem Movement Controls**:
- `select_gem`: Enter key, Gamepad A button
- `move_up/down/left/right`: Arrow keys, WASD, Gamepad D-pad
- Rendering settings
- Audio bus references
@@ -288,8 +302,18 @@ DebugManager.log_error("Failed to load audio resource")
# Logging with custom categories for better organization
DebugManager.log_debug("Grid regenerated with 64 tiles", "Match3")
DebugManager.log_info("Language changed to: en", "SettingsManager")
DebugManager.log_info("Language changed to: en", "Settings")
DebugManager.log_error("Invalid scene path provided", "GameManager")
# Standard categories in use:
# - GameManager: Scene transitions, gameplay mode management
# - Match3: Match-3 gameplay, grid operations, tile interactions
# - Settings: Settings management, language changes
# - Game: Main game scene, mode switching
# - MainMenu: Main menu interactions
# - PressAnyKey: Press any key screen
# - Clickomania: Clickomania gameplay mode
# - DebugMenu: Debug menu operations
```
### Log Format
@@ -322,6 +346,16 @@ if DebugManager._should_log(DebugManager.LogLevel.DEBUG):
### Current Implementation Status
- Modular gameplay system with dynamic loading architecture
- Match-3 system with 8x8 grid and configurable gem pools
- **Interactive Match-3 Gameplay**: Keyboard and gamepad gem movement system
- Keyboard: Arrow key navigation with Enter to select/confirm (WASD also supported)
- Gamepad: D-pad navigation with A button to select/confirm
- Visual feedback: Tile highlighting, selection indicators, smooth animations
- Game logic: Adjacent-only swaps, match validation, automatic revert on invalid moves
- State machine: WAITING → SELECTING → SWAPPING → PROCESSING states
- **Comprehensive Logging System**: All print()/push_error() statements migrated to DebugManager
- Structured logging with categories: GameManager, Match3, Settings, Game, MainMenu, etc.
- Multiple log levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Debug mode integration with level filtering
- Global scoring system integrated across gameplay modes
- Debug UI system with F12 toggle functionality across all major scenes
- Scene transition system via GameManager with gameplay mode support