Quantcast
Channel: Questions in topic: "footsteps"
Viewing all articles
Browse latest Browse all 164

Can anyone help me modify this simple script?

$
0
0
Hello Everyone, At the current moment, I am working on making footstep audio. The script I have basically says to play audio when the "W" key is held down, and stop when it is let go. This script works perfectly, but the only problem is if you walk sideways or backwards, the audio doesn't play... Basically, I'm wondering if anybody can help me modify this script so that it has multiple keycodes for "W" "A" "S" and "D." If anybody could help me out with this, I wouls REALLY appreciate it! Thank you so much for your time! #pragma strict var AudioFile : AudioClip; function Update() { if (Input.GetKeyDown (KeyCode.W)) { audio.clip = AudioFile; audio.Play(); } else if (Input.GetKeyUp (KeyCode.W)) { audio.Stop(); } } if (Input.GetKeyDown (KeyCode.W)) { audio.clip = AudioFile; audio.Play(); }

Viewing all articles
Browse latest Browse all 164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>