They said no game is complete without sound effects. Although it is in style to not include music in some games today, we will just give our players an option to mute it if they so desire. Note that there are devices that have certain limits on bitrate. Best advice is to look up the export format you are targeting in general, but a rule of thumb is you usually want a bitrate of 70 or lower to ensure it plays on all devices. You can lower bitrate by using audio editing software.
Let us start by creating a simple game.
Now let us go to the Game Mind Map by clicking the Menu Editor Button on the upper left hand side. Once on the Mind Map, you will see green and blue nodes. To hear music in the game, all we need to do is to drag an MP3 in the options panel when we select the user interfaces (green nodes).
If you want to put a background music when you start your game all you need to do is to click the start node and drag an MP3 to the music portion of the options panel.
To trigger a game over music every time the player dies, we need to select the Game Over UI and drag the MP3 to the music slot.
Just keep in mind that if you put music on each and every UI and if our player is dying a lot and restarting different music over and over, that might get annoying for the players.
Let talk about sound effects. The perfect place to start is right on the Main Menu.
Double click the Main Menu UI and you will see the below illustration. To add a sound effect every time you press start, drag and drop your MP3 to the Click Sound slot.
Now lets go over your game world where we can add more sound effects. Double click the blue node to open it.
Once inside, click on your character on the assets menu on the left to see the different sound effects you can include.
You can also do the same to the your game enemies and platforms.
Now let us talk about muting our music and sound effects.
One of the way to do this is to create a mute and unmute option in our pause menu.
To do this let us go to the Pause UI
Once inside, let us drag and drop and Audio Button and a Label.
Lets edit the label by typing in the Text box.
Now lets modify our Audio Button by dragging and dropping our mute and unmute button in the options panel to the right and make sure that Background music is selected as the Function.
And you can do the same on Sound Effects.