Sound)
The student is wanting to have the sound work play when plane is touching a coin. The sound should stop if the plane is not touching a cone. Any help? The sound currently plays continuously.
Sound)
The student is wanting to have the sound work play when plane is touching a coin. The sound should stop if the plane is not touching a cone. Any help? The sound currently plays continuously.
Hi @leslie.dillon,
Sound is a tricky thing sometimes! I think the fix here is easy. I see that an else statement was added to each coin stopping the sound. Unfortunately, what this does is says do not play any sound if the plane is not touching those coins which is most of the time. So, when I played the game, the sound did not play most of time (except for an occasional bell).
The playSound block has a boolean property and if it is set to true, it will repeat or loop but if it is set to false it will only play once. I think you just need to set this property to false and remove the else statements.
Good luck with this fun game!
~Michelle
Greetings @leslie.dillon
While I agree with @melynn about how the sound trigger can be resolved I’ll just exemplify or my own personal documented experience with this function
// playSound(id, loop?, callback?)
// @Param id (string): the url, or stored sound in CDO database
// @Param loop (boolean): the [optional] parameter in which allows the sound to loop
// which is usually only good if you want background sound, if not invoked
// or explicitly definied as true the sound will not loop for example
playSound("bell.mp3");
// is the same as
playSound("bell.mp3", false);
// @Param callback (function): [optional] playSound is an asynchronous function which means it
// executes outside of the game loop but it only usually happens on big
// mp3's on first loads but not something to worry about if your getting
// started
though I’m pretty sure the second one looks a bit clearer i personally prefer using the first one additionally with this you won’t need stopSound() in your else statements for collisions
anyways best of luck on the project it’s almost there! you can always reply if you need further clarification!
Best Wishes, Varrience