Dual Button Press to run?

sooo, i have seen other games implementing a gfeature that changes up the audio when running im not quite sure how to do that.

this is what i have,

var AudioFile : AudioClip;
function Update() {

if (Input.GetKeyDown (KeyCode.W))
{
    audio.clip = AudioFile;
    audio.Play();
 
}}

function Update() {

if (Input.GetKeyUp (KeyCode.W))
{
    audio.clip = AudioFile;
    audio.Stop();
 
}
}

but what my real question is, how do you require a function to work by pressing two buttons at once?

1 Answer

1

var AudioFile : AudioClip;
var AudioFile2 : AudioClip;
function Update() {
var run : boolean;

if (Input.GetKeyDown (KeyCode.W))
{
    run = false;
    audio.clip = AudioFile;
    audio.Play();
    
}
else if (Input.GetKeyUp (KeyCode.W))
{
    run = false;
    audio.clip = AudioFile;
    audio.Stop();
   
}
if (Input.GetKeyDown ("left shift"))
{
    run = true;
    audio.clip = AudioFile2;
    audio.Play();
    
}
}

figured it out