Need a Sound!
I am working on Project: Shooting Star in the Intro to JS lesson and am trying to make buildings in the background. I also want sounds, but neither are working. I need help!!!!!!! here is code:
I am working on Project: Shooting Star in the Intro to JS lesson and am trying to make buildings in the background. I also want sounds, but neither are working. I need help!!!!!!! here is code:
As part of our Support Community improvement project, we’re preserving inactive posts that have historical or community value and closing them to new comments. This is one of them!
If this post covers a topic that you’re interested in discussing with the community or requests a feature you’d like to see on Khan Academy, you can try to find an active post about it and add your thoughts (or feel free or create a new post if it doesn’t yet exist in the forum).
Hi there,
I see a couple issues with your code that are preventing the sounds from being played. Your aPos variable starts at 395 and then is repeatedly decremented. That means it will never be greater than 400, so the boom1 sound will not be played. Additionally, the boom1 sounded is located within the landing function, which is never called. You have to call the function in order for the code inside it to be executed.
You also shouldn't include playSound() calls directly within the draw function without any conditions for playing the sound, since repeatedly looping/playing sounds goes against our Program Guidelines.
I hope this helps! Please let me know if you have any additional questions!
Post is closed for comments.