Adding background music that plays throughout can be a great way to enhance your world. The challenge is to make sure that all other activity in your world doesn’t stop and wait for the audio file to play.
One easy way to separate your background music code from your main program is to set up your background music in the event listeners tab. To implement music or sound to play on world start through an event listener:
– Go to the “initializeEventListeners” tab Go to Add Event Listener, then addSceneActivationListener.
– Drag your playAudio procedure into that event listener and select the music you want.
To have that audio file repeat continuously while your world is playing you can add the play audio to a while loop:
– Drag a while function into your new do in order that you created and select true.
– Drag your playAudio procedure into the while loop.