- Home /
Change animation after double tapping arrow
I am trying to get my character to change animations after i double tap the up arrow twice. I have searched the forum but cant find a way. I have tried this but it just makes it run and not walk if tapped once.
float lastTime = -1.0f;
  if (Input.GetKey(KeyCode.RightArrow)) {
         animation.CrossFade("strafeRight");
     }
     else if (Input.GetKey(KeyCode.LeftArrow)) {
         animation.CrossFade("strafeLeft");
     }
     else  if (Input.GetKey(KeyCode.UpArrow)) {
         if (Time.time - lastTime < 0.2f)
         {
             lastTime = Time.time;
             animation.CrossFade ("run");
         }
         else 
         {
             lastTime = Time.time;
             animation.CrossFade("walk");
         }
     }
     
     else {
 animation.CrossFade("idle");
 }
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                