How do I stop a sounds on touch?
vesh
Member Posts: 1
Hi guys complete newbie here so explain as simple as possible!
I am making a sound board app. I made an image for a button and to play the sound on it, I'd put in the touch block, then in do on that drag in the sound I want to play.
That works but if I press on another sound or even change scenes, any sound pressed that hasn't finished yet keeps continuing. I want to be able to stop it again on touch or stop if I have touched somewhere else on the screen. Can this be done?
Also what is difference between sound and music? My sounds are .ogg files (converted from mp3 as they do not work and wav is just way too big) and I see the play music block but no option to choose out of the ogg files so then can't stop music. Why isn't there a stop sound block?
Thanks
I am making a sound board app. I made an image for a button and to play the sound on it, I'd put in the touch block, then in do on that drag in the sound I want to play.
That works but if I press on another sound or even change scenes, any sound pressed that hasn't finished yet keeps continuing. I want to be able to stop it again on touch or stop if I have touched somewhere else on the screen. Can this be done?
Also what is difference between sound and music? My sounds are .ogg files (converted from mp3 as they do not work and wav is just way too big) and I see the play music block but no option to choose out of the ogg files so then can't stop music. Why isn't there a stop sound block?
Thanks
Comments
Create or select the actor you want to stop the music (if you want to click anywhere to stop it I suggest you make a background actor taking up the screen) Double click the actor to enter it. Create a rule (top right) and click the 'mouse position' text in the rule and change it to 'touch'. After that go to the behaviours section (bottom left) and find 'stop music'. Drag it into the rule and voila! Hope this helped. Feel free to ask a question.
Extra:
You might find that you only want the music to play once but instead it loops. To fix this go to the 'play music' behaviour in your rule and un-check the little 'loop' box. I hope this helped, feel free to ask any questions.
How do I import the sounds as music? I just chose the files and it made them sounds automatically