To debug the issue of repeatition of sound

I want to sea animals to appear one after another and want to play respective sound as well.
But there is an issue in sound.Not able to stop the sound …it’s playing repeatedly.
Please help me to debug this

Hi @learnfromsushmita,

The link you posted takes me to my Code.org dashboard. Can you click the SHARE link of the project and post that here? We’d love to take a look and give you some tips.

Michelle

Please refer.
Regards
Sushmita

The idea of this project is to create random bubble after certain frameCounts.When someone clicks on the bubble it should burst and a sea animal should appear with it’s specific sound.

Bug: There is repeation of the sound of the animal when the bubble is bursted.

So want to fix this and get sea animals generated one after another with bursting of bubble with no repeatition of sound.

Looking forward to the issue resolution. :slight_smile:
Regards
Sushmita

Hi @learnfromsushmita,

The bug (the repeating sound) occurs because vdefiner stays a constant value while it is inside the loop. So, the sound will play 32 time per second for as long as that variable holds that value. You will need to immediately change the value of vdefiner in some way to get the sound to stop looping. Here is a post with some example solutions.

As for the sea animals, it looks like your sea animals are being generated randomly but they are not associated with a bubble animation BEFORE I click on them but there ARE associated with an animal animation AFTER I click on them. Can you associate a bubble animation to the animal BEFORE the mouse click in the same way you associated an animal animation after the mouse click?

FYI - I like the use of the modulus to time the animation - very clever.

Good luck as you continue to iterate the game!
~Michelle

1 Like