Using sound effects and music in Gamefroot has never been easier.
We’ve put together the following tutorial based on the popular open source game Friday Night Funkin’ to help you get started with sound in Gamefroot.
Here’s how it works:
Start by remixing the demo project:
The project will open and you’ll see that we have already included a background image and a white play button for you to use.
Click on the following link to download the Friday Night Funkin’ sound files:
Inside Gamefroot, click on Add New Media in the Media sidebar, then click Upload Media.
Click on the + icon to browse to your audio files on your device, and then select them.
Once your files have uploaded, click Save.
Your sound files will appear in the sidebar, and you can click the play button on them to hear what they sound like.
Now we need some way to trigger the sound in game. Right-click on an object in your game, and click Add Script.
From inside the script editor we can trigger sounds to play whenever we want, and the easiest way to do this is When the level starts. Open Events and drag out “When the level starts”.
Then open Sounds and drag “play music sound sound” into “When the level starts”.
The “sound” block has no value yet, so it doesn’t know what sound to play. To fix this, we will make it a public property, so that it appears in the Properties panel. Click on the cog icon in the top-left, and click Script Properties.
Then tick the checkbox next to “Sound” to make this a public variable.
Click Done, and then click the back arrow in the top-left to close your script. Make sure to give it a name and save it when it asks you to do so.
Then back in your level, click on the white play button object to make sure it is selected, and then find the Sound property in the Properties panel underneath Layers. Click on the drop down arrow to pick your sound.
Then click Play in the top-right. Your sound should play!
Tip: The “play music” block will loop a sound file, but the “play sound effect” block will play a sound file once.
Credit goes to the team that made Friday Night Funkin’ an amazing open source game! https://github.com/ninjamuffin99/Funkin