[SOLVED]Back walk animation

here is my script that deals with animation. Everything works satisfying. But i cannot implement
a backwalk animation help needed. Here’s the code:

function Start ()
{
  
 animation.wrapMode = WrapMode.Loop;
 animation["jump"].wrapMode = WrapMode.Once;
 animation["shoot"].wrapMode = WrapMode.Once;
 
  
   animation["jump"].layer = 1;
   animation["shoot"].layer = 0;
   
   animation.Stop();
}

function Update () {
   
   if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1)
      animation.CrossFade("walk");
	//this is my lame attempt
	//if (Mathf.Abs(Input.GetAxis("Vertical")) < 0.1)
	//animation.CrossFade("backWalk");
	  
   else
      animation.CrossFade("idle");

   // Jumping
   if (Input.GetButtonDown ("Jump"))
      animation.CrossFade("jump");

   if (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.1)
animation.CrossFade("leanRight");
// Shooting
 if (Input.GetButtonDown ("Fire1"))
      animation.CrossFade("shoot");
	  
  
}

P.S. Shooting animation is not working… any clues?

So any ideas how to lunch a backwalk animation when “S” button is down?

try

   if (Input.GetAxis("Vertical") > 0.1) 
      animation.CrossFade("walk"); 

   if (Input.GetAxis("Vertical") < -0.1) 
      animation.CrossFade("backWalk");

Abs only returns positive numbers (ie, 1.0 and -1.0 both become 1.0) so you’d never get the negative values that represent backwards movement.

Thnx Sycle. U’re right. It Works perfectly. But now it gives me another issue - the walk animation doesn’t work((( Here is a code :
p.s. I’ve corrected the shooting now it works, with possibility to change shooting animation speed.

var animShoot; 

function Start ()
{
   // Set all animations to loop
   animation.wrapMode = WrapMode.Loop;
   // except shooting
   animation["jump"].wrapMode = WrapMode.Once;
   animation["shoot"].wrapMode = WrapMode.Once;
   
   animShoot = animation["shoot"];
   animShoot.speed = 0.1;
     
   animation["jump"].layer = 1;
   animation["shoot"].layer = 0;
   
   animation.Stop();
}

function Update () {
   // Based on the key that is pressed,
   // play the walk animation or the idle animation
   if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1)
      animation.CrossFade("walk");
	
 if (Input.GetAxis("Vertical") < -0.1)
      animation.CrossFade("backWalk"); 
	  
  else
      animation.CrossFade("idle");

   // Jumping
   if (Input.GetButtonDown ("Jump"))
      animation.CrossFade("jump");

   if (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.1)
animation.CrossFade("leanRight");
// Shooting
   
} 
function FixedUpdate()
{
   if (Input.GetButton ("Fire1"))
   {
      animation.Play("shoot");
      animation.CrossFade("walk");
   }
   
}

OMG i’m lame! All what i had to do was to put backwalk after else statement:

function Update () {
   // Based on the key that is pressed,
   // play the walk animation or the idle animation
   if (Input.GetAxis("Vertical") > 0.1)
      animation.CrossFade("walk"); 
	
  else
      animation.CrossFade("idle");


   if (Input.GetAxis("Vertical") < -0.1)
      animation.CrossFade("backWalk");