Playing sprint animation with vertical axis?

So I have made this JS script that works fine with walking. When the vertical axis is 0.01 or higher it goes from the idle to the walking animation.

The question is, how do I get it to play a sprint animation this way? Any other way is also fine aslong as it’s useable in this script.

I use the parameters ‘Walking’ and ‘Sprinting’.

#pragma strict
internal var animator : Animator;
var hor : float;
var ver : float;

function Start () {

    animator = GetComponent(Animator);
function Update () {

    hor = Input.GetAxis("Horizontal");
    ver = Input.GetAxis("Vertical");

function FixedUpdate() {

    animator.SetFloat("Walking", ver);
    animator.SetFloat("Sprinting", ver);


The quickest way to get that to work in this script is probably to add a couple if statements where you are setting the floats. Something along the lines of: if(ver > 0.01 && ver <= 0.7) do Walking and if(ver >0.7) do Sprinting

That said I would suggest sending the ver float to the animator once as “speed”, and handling the range for speed in the animator controller with transitions or a blend tree.