Why is my second song bugged?

(Code.org)
What I expect to happen: I expected the second song to play when I got over 5 points.
What actually happens: It sounds like it is scrambled.
What I’ve tried: I have created a variable for the sound, I also created a function for the sound I want to play.

Hi @svflake,

The song sounds distorted because it is being called multiple times from the draw loop. I followed the same pattern you implemented in another game you posted to switch songs and it worked well HERE. It is a good model for calling a song to play only one time in the draw loop even though the draw loop repeats 32ish times per second! Your pattern is when the condition is reached to switch songs, stop the current song and start a counter then create another if statement that starts the new song when the counter is == 1. Seems to work:)

Good luck!
~Michelle