this is the scipt:
how to fix ?
function Update()
{
var aniPlay = GetComponent ( “aniSprite” );
//aniPlay.aniSprite (16, 16, 0, 0, 16, 12 );
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded)
{
jumpEnable = false;
runJumpEnable = false;
crouchJumpEnable = false;
velocity= Vector3(Input.GetAxis("Horizontal"), 0,0 );
if ( velocity.x == 0 && moveDirection == 1 )
{
aniPlay.aniSprite (16, 16, 0, 0, 16, 12 );
}
if ( velocity.x == 0 && moveDirection == 0)
{
aniPlay.aniSprite (16, 16, 0, 1, 16, 12 );
}
if ( velocity.x < 0 )
{
velocity *= walkSpeed;
aniPlay.aniSprite ( 16, 16, 0, 3, 10, 15 );
}
if ( velocity.x > 0 )
{
velocity *= walkSpeed;
aniPlay.aniSprite ( 16, 16, 0, 2, 10, 15 );
}
if (velocity.x < 0 && Input.GetButton ( "Fire1" ) )
{
velocity *= runSpeed;
aniPlay.aniSprite ( 16, 16, 0, 5, 16, 24 );
}
if (velocity.x > 0 && Input.GetButton ( "Fire1" ) )
{
velocity *= runSpeed;
aniPlay.aniSprite ( 16, 16, 0, 4, 16, 24 );
}
if ( velocity.x == 0 && Input.GetAxis ( "Vertical" ) < 0)
{
if ( moveDirection == 0 )
{
velocity.x = 0;
aniPlay.aniSprite ( 16, 16, 0, 9, 16, 24 );
}
if ( moveDirection == 1 )
{
velocity.x = 0;
aniPlay.aniSprite ( 16, 16, 0, 8, 16, 24 );
}
}
if ( Input.GetButtonDown ( "Jump" ) && ( !Input.GetButton ( "Fire1" ) ||Input.GetButton ( "Fire1") && velocity.x == 0 ) && Input.GetAxis ( "Vertical" ) >= 0 )
{
velocity.y = walkJump;
jumpEnable = true;
}
if ( Input.GetButtonDown ( "Jump" ) && Input.GetButton ( "Fire1" ) && velocity.x !=0 )
{
velocity.y = runJump;
runJumpEnable = true;
}
if ( Input.GetButtonDown ( "Jump" ) && velocity.x == 0 && Input.GetAxis ( "Vertical" ) < 0 )
{
velocity.y = crouchJump;
crouchJumpEnable = true;
}
}
if ( !controller.isGrounded )
{
if ( Input.GetMouseButtonUp ( "Jump" ) ) // #ERROR
{
velocity.y = velocity.y - fallSpeed;
}
velocity.x = Input.GetAxis ( "Horizontal" );
velocity.x *= walkSpeed;
}
if ( velocity.x < 0 )
{
moveDirection = 0;
}
if ( velocity.x > 0 )
{
moveDirection = 1;
}
velocity.y -= gravity * Time.deltaTime;
controller.Move ( velocity* Time.deltaTime );
}