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

Footstep sounds play when im not moving or if im running, but stop when i move,

$
0
0
#pragma strict var walk : AudioClip; var run : AudioClip; var isWalking : boolean = false; var isRunning : boolean = false; function Update() { GetState(); PlayAudio(); } function GetState() //asks is the player running or walking? { if ( Input.GetAxis( "Horizontal" ) || Input.GetAxis( "Vertical" ) ) { if ( Input.GetKey( "left shift" ) || Input.GetKey( "right shift" ) ) { isWalking = false; isRunning = true; } else { isWalking = true; isRunning = false; } } else { isWalking = false; isRunning = false; } } function PlayAudio() { if (isWalking == true) { audio.Play(); } } i havent put a running sound in yet. But when I start the game, the audio automatically plays. when i start walking, a weird flatline sound plays, but when i run, i hear the walking audio again. help??

Viewing all articles
Browse latest Browse all 164

Trending Articles



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