Add Piano Hero rhythm game with song library and scoring#1
Open
mrfeixiang wants to merge 5 commits intomainfrom
Open
Add Piano Hero rhythm game with song library and scoring#1mrfeixiang wants to merge 5 commits intomainfrom
mrfeixiang wants to merge 5 commits intomainfrom
Conversation
Three-file vanilla JS implementation (piano.html + piano.css + piano.js): - 5 beginner songs (Twinkle Twinkle, Mary Had a Little Lamb, Hot Cross Buns, Happy Birthday, Ode to Joy) with beat-based timing data - Falling-note highway with per-note neon lane colors and GPU-composited animation - Web Audio API synthesized piano tones (no samples needed) - Keyboard input (A-K white keys, W/E/T/Y/U black keys) + mouse/touch on keyboard - PERFECT/GOOD/MISS hit detection with ±55ms / ±130ms windows - Combo multiplier (1×–4×), grade system (S/A/B/C/D), localStorage high scores - 3-2-1-GO countdown, pause/resume, and results screen https://claude.ai/code/session_011YpsvHY5f8LZtroDhY8Yvn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a complete rhythm game implementation called "Piano Hero" with a full-featured web application including gameplay mechanics, audio synthesis, song library, and scoring system.
Key Changes
GameEngineclass): Core game loop with state management (menu, songs, playing, paused, results), song progression, note spawning with lookahead, and hit detection with timing windowsAudioEngineclass): Web Audio API integration with synthesized piano sounds using dual oscillators, envelope shaping, and low-pass filteringInputManagerclass): Keyboard and touch/mouse input support for both physical piano keys and on-screen keyboard, with proper event debouncingNoteRendererclass): Falling note animation system with position calculation based on fall speed and hit timing, hit/miss visual feedbackScoreTrackerclass): Hit detection with perfect/good/miss judgments, combo tracking with multipliers, and letter grade calculationSongLibraryclass): Pre-loaded song collection (Twinkle Twinkle, Mary Had a Little Lamb, Hot Cross Buns, Happy Birthday, Ode to Joy) with BPM and difficulty metadataNotable Implementation Details
https://claude.ai/code/session_011YpsvHY5f8LZtroDhY8Yvn