Assets/Player.js(10,34): BCE0077: It is not possible to invoke an expression of type 'boolean'.

heyy guys , i’m trying to learn the basis of game animation and programming. I’ve been getting this error and don’t know what to do . This is the script please tell me whats wrong


var PlayerState : float ;
var PlayerAnimSec : GameObject ;
function Update ()
{
PlayerstateController ();
PlayerAnim ();
}
function PlayerstateController ()
{
   if ((Input.GetAxis("Vertical")!=0 ) ( Input.GetAxis("Horizontal")!=0) )
   
      if (Input.Get ("sprint"))
      {
      PlayerState = 2;
      }
      else 
      {
      PlayerState = 1;
      }
      else 
      {
      PlayerState = 0;
      }
   }

function PlayerAnim ()
{
if (PlayerState == 0)
  {
  PlayerAnimSec.animation.CrossFade("idle", 0.4);
  }
else if (PlayerState == 1)
  {
  PlayerAnimSec.animation.CrossFade("walk", 0.4);
  }
 else if (PlayerState == 2)
  {
  PlayerAnimSec.animation.CrossFade("run", 0.4);
  }
}

The two GetAxis expressions should be connected by some logical operator (probably OR), and Input.Get doesn’t exist: it probably should be GetButton. Additionally, you should use some clear and self explanatory code layout - at first sight, your code seems to have two else for a single if! Indentation and brackets are your friends: use them wisely, or you may end with a completely unreadable code - a really bad thing when you need to fix logic errors.

// you must have a logical OR connecting the two expressions:
if ((Input.GetAxis("Vertical")!=0 ) || ( Input.GetAxis("Horizontal")!=0) ){
  // Get what? Probably it should be GetButton:
  if (Input.GetButton ("sprint")){
    PlayerState = 2;
  } else {
    PlayerState = 1;
  }
} else {
  PlayerState = 0;
}