Howdy! I’d like to state first that I’m an audio guy (sound design, music) that has, of this year, gotten really into wanting to learn how to do audio for games and to implement them properly into said games.
I’ve been digging through the forums here and elsewhere online to find different ways of triggering different sounds for when the player is on different surfaces e.g. stone, wood, grass, etc. Though with my situation, I’ve been going through the Tornado-Twins worm-game tutorial (some of you may be familiar with it, and again I’m quite new hence me doing said tutorials) and I’ve finished all the videos in the tutorial and wanting to get very detailed sound use in it.
So my case I have a worm character scooting around the ground, got some water in the level with sound triggers going on and recently created a script that plays a sound when I move my character using WASD or the Arrow Keys and that mutes it when I’m not, which I feel like there is a better way in general for getting sound playing instead of attaching it to the character. Here is the simple script:
var AudioFile : AudioClip;
function Update()
{
if ( Input.GetButtonDown( "Horizontal" ) || Input.GetButtonDown( "Vertical" ) )
audio.Play();
else if ( !Input.GetButton( "Horizontal" ) && !Input.GetButton( "Vertical" ) && audio.isPlaying )
audio.Stop(); // or Pause()
}
Any suggestions would be greatly appreciated! Also, on a similar note, I could definitely learn/know more on scripting in regards to audio (and in general), does anyone know of a good source to check out to learn more about scripting (books, videos, web)? I’m not expecting to be a guru in a week I just wish to be less ignorant about game development and especially on the audio end that I’m interested in.
Thank you very much in advance for your time reading this novel of a post and for any and all help!