- Home /
 
 
               Question by 
               Syrant · May 02, 2015 at 11:02 PM · 
                movementcontrollerspeed  
              
 
              Continuing Speed when changing direction
So I'm trying to get my character to run faster when a direction is double tapped. While I have that working, I want that speed to continue as long as ANY directional button is held down. That way they can change directions without reverting to speed of 2. I've tried making this work with GetKeyUp, using a boolean, etc, but nothing seems to be working the way I want.
         if(Input.GetKeyDown("w") || Input.GetKeyDown("a") || Input.GetKeyDown("s") || Input.GetKeyDown("d") || Input.GetKeyDown("a")&&Input.GetKeyDown("s") 
            || Input.GetKeyDown("w")&&Input.GetKeyDown("d") || Input.GetKeyDown("w")&&Input.GetKeyDown("a") || Input.GetKeyDown("s")&&Input.GetKeyDown("d"))
         {
             if ( ButtonCooler > 0 && ButtonCount == 1/*Number of Taps you want Minus One*/)
             {    
                 speed = 4 ;
             }
             
             else
             {
                 ButtonCooler = 0.5 ; 
                 ButtonCount += 1 ;
                 speed = 2;
             }
         }
         
         
         if ( ButtonCooler > 0 )
         {
             ButtonCooler -= 1 * Time.deltaTime ;
         }
         
         else
         {
             ButtonCount = 0 ;
         }
     }
 
              
               Comment
              
 
               
              Your answer