How to play sounds only once, opon collisions, etc?

JerichoBLT

  • Posts: 12
The title says it all... By default sounds play every single frame as long as the collision is happening.   If I use the "play sound on channel 1 block" for example, the sound repetitively plays interrupting itself.  If I use the "play sound block" the sound repetitively plays over top of itself.   How can I get the sound to play only once when the collision first starts happening?

BMJ

  • Posts: 278
You need to use a control Boolean, such as [Can Play Collision SFX?]. Create this attribute, define it as boolean. Set the default to TRUE. Use an "if" block to only allow the sfx to play if the control Boolean [Can play Collision SFX?] = TRUE.  Then set the boolean to FALSE. You'll also need a way to reset it to TRUE to allow the sound to play again in the future. The simplest way would be to do this on a timer. (After n seconds, set the Boolean back to TRUE). Do this just after the sound is played. There is a more sophisticated way to reset it, but if you are new then this is probably the easiest way.

JerichoBLT

  • Posts: 12
It worked for me!  Thanks! :D