So the problem is when I press D and S it moves across the horizontal line which is what I wanted, but I assigned a parameter to the character so when I am going over a speed of 0.1 the walking cycle starts and when I go over 3, the running cycle starts. How do I make this happen.
Here’s my code.
var runSpeed : float = 10;
var moveSpeed : float = 3;
var walkingSpeed : float = 0.1;
var golemAnimator : Animator;
function Update ()
{
var input = Input.GetAxis("Horizontal");
if(input < walkingSpeed || input > walkingSpeed)
{
runSpeed = input*moveSpeed*Time.deltaTime;
transform.position.x += runSpeed;
golemAnimator.SetFloat("Running Speed", runSpeed);
}
}