You know, this is a rookie mistake. But, swallowing my pride… please help. The while loop I put in is looping infinitely.
I originally wanted it to be…
while (movement buttons are pressed){
allow for sprinting;
change boolean “sprintable” to TRUE;
}
So… this is just a question; should I have made this an IF statement instead of a while? I’ll test that to make sure as well. However, I want to know if it would work.
`#pragma strict
private var sprintable : boolean;
function Start () {
}
function Update () {
// Initiates the sprintable boolean, if movement buttons are pressed down. If these are pressed, the user is
// able to increase their speed by pressing shift alongside it.
// currently creates an infinite loop...
while(Input.GetKeyDown("w") || Input.GetKeyDown("a") || Input.GetKeyDown("s") || Input.GetKeyDown("d")){
sprintable = true;
Debug.Log('You are moving!');
}
}`
Thanks in advance.