Skip to content

Commit 5082043

Browse files
committed
fix(audio): play music for all 50 levels by cycling through tracks 1-10
1 parent 3e74ad8 commit 5082043

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

components/Views.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,10 @@ const useBackgroundMusic = (level: number, isMuted: boolean = false) => {
924924

925925
// Handle level changes
926926
useEffect(() => {
927-
// Only play music for levels 1-10
928-
if (level >= 1 && level <= 10) {
929-
const musicPath = `Sounds/Level ${level}.mp3`;
927+
// Map any level to one of the 10 available tracks (cycles through 1-10)
928+
if (level >= 1) {
929+
const trackNumber = ((level - 1) % 10) + 1;
930+
const musicPath = `Sounds/Level ${trackNumber}.mp3`;
930931

931932
// Create new audio element
932933
const audio = new Audio(musicPath);

0 commit comments

Comments
 (0)