# Game Mechanics Refactor - Walkthrough ## Summary Successfully refactored the game from a **lap-based racing system** to a **cycle-based goals system** with power-ups, scoring, and a live leaderboard. --- ## Changes Made ### New Files Created | File | Purpose | |------|---------| | [goals_cycle_manager.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scripts/managers/goals_cycle_manager.gd) | 60-sec timer, scoring (base+time bonus), goal regeneration, 9-tile randomization | | [powerup_manager.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scripts/managers/powerup_manager.gd) | Power-up points (4 bars max), holo tile tracking, special effect activation | ### Modified Files | File | Changes | |------|---------| | [player.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scenes/player.gd) | Added `powerup_manager`, `score`, use_powerup input, removed finish checks | | [playerboard_manager.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scripts/managers/playerboard_manager.gd) | Holo tiles → powerup points, goal completion check | | [player_race_manager.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scripts/managers/player_race_manager.gd) | Deprecated lap system, kept pattern matching | | [main.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scenes/main.gd) | GoalsCycleManager init, UI setups, signal handlers | | [ui_manager.gd](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/scripts/managers/ui_manager.gd) | Power-up bar, leaderboard panel, timer labels | | [project.godot](file:///c:/Users/ADT/Documents/GodotProjects/tekton-enet/project.godot) | Added `use_powerup` input (F key) | --- ## New Game Flow ```mermaid flowchart LR A[60s Cycle] --> B[Grab Tiles] B --> C{Holo?} C -->|Yes| D[+Powerup] C -->|No| E[Check Goal] E -->|Match| F[+Score +Powerup +Randomize 9 tiles] F --> G[New Goals] A --> H{Timer End} H --> I[Clear Board → Score Matching] ``` --- ## Manual Testing Required 1. **Timer Test**: Verify 60-sec countdown on goal panels 2. **Goal Completion**: Complete pattern → score + powerup + tile randomization 3. **Holo Tiles**: Pick 4 → 1 powerup bar (no auto effect) 4. **F Key**: Use powerup → triggers random special effect 5. **Leaderboard**: Updates dynamically with score rankings 6. **Multiplayer Sync**: Timer and scores sync across clients