heres my code:
#pragma strict
var canjump=true;
var isfalling=true;
var speed : float = 12.0;
var jumpSpeed : float = 15.0;
var gravity : float = 20.0;
private var moveDirection : Vector3 = Vector3.zero;
private var vertVel: float = 0; // vertical velocity
function Update() {
var controller : CharacterController = GetComponent(CharacterController);
// read the controls outside the if:
moveDirection = Vector3(Input.GetAxis("Horizontal"), 0, 0);
moveDirection = transform.TransformDirection(moveDirection) * speed;
if (controller.isGrounded) { // if it's grounded...
if (Input.GetButton ("Jump")) { // and Jump is pressed...
animation.Play("jump_pose");
vertVel = jumpSpeed; // vertical velocity = jumpSpeed
}
animation.Play("run");
}
vertVel -= gravity * Time.deltaTime; // apply gravity to the vertical velocity
moveDirection.y = vertVel; // combine move direction with vertical velocity
controller.Move(moveDirection * Time.deltaTime); // and Move
}
if i remove animation.play(“run”);
than it does perform animation but dosent run again.