Putting sfx and music is very easy with ge
As far as what format to use I personally think it depends on your target device. If you are going to make the game for pc you can really do anything, I would use 44.1khz wav files for sound effects and ogg's for music. If your target device is the iphone you might want to push it down to 22.05khz. I find that using 44.1khz on my itouch device causes random crashes.
You can make music play by adding...
level actor -> add event "create actor" -> "play music"
I am pretty sure you already have a script editor for your level so you may just want to add it in the script editor. Go to variables/functions tab in the script editor and select "play music2" It will bring up the same menu as the previous and then it will automatically write the script to do it for you.
Adding sound effects is very similar but you would probably want them to happen in different places. For instance when a bullet or something hits the wall or an enemy. You would put: bullet actor -> collision -> (collision with wall or enemy) -> play sound.
The thing to note is that sounds play on top of each other. So you can play a whole bunch simultaneously. Music however when called stops the current file playing and starts the next one.
You can control the volume of everything a few different ways. For me the easiest way to do this was to make a global variable sfx_volume and insert that into what should be the assigned volume for every sound effect. You would have to do these inside script editor to be able to edit the volume values correctly. Example:
- Code: Select all
PlaySound2("C:\click.wav", 0.8, 1, 0.3);
In the above code 0.8 is the volume, 1 is the amount of times it will be played (loop), and 0.3 is the pan. You would just replace the volume with sfx_volume.
- Code: Select all
PlaySound2("C:\click.wav", sfx_volume, 1, 0.3);
The music channel has this built in already so you would just need to call:
- Code: Select all
sfx_volume = 0;
musicvol = 0; //this is game editors built in volume control for the music
In order to mute it. If you would like to change them back just set them to 1.
I am sure others might write a simple for loop statement using "setVolume" but to me the above way gives you a little more control. If you do not have a means of "normalizing" the volume and you have one that is too loud you can easily knock it back by saying sfx_volume/1.2 or something to make it a little lower in volume.
Hope this works for you! Let me know if you need anything explained a little further