setting up animations

have animations i have done it before but i cant remeber how i was wondering if something could look at my code and see how i have failed
when i try to move to activate the animation it doesnt move and when i comment it out and put it back to normal it moves

using UnityEngine;

using System.Collections;

public class Movement : MonoBehaviour {

public float Speed = 5.0f;
Animator anim;
public bool Ismoving;

// Use this for initialization
void Start () {
	anim = GetComponent<Animator> ();
}

// Update is called once per frame
public void Update () {
		var x = Input.GetAxis ("Horizontal") * Speed * Time.deltaTime;
		var z = Input.GetAxis ("Vertical") * Speed * Time.deltaTime;
		transform.Translate (x, 0, z);
		Ismoving = true;
	anim.SetFloat ("Speed", Speed);
	if(Input.GetAxis("Horizontal") && Input.GetAxis("Vertical") == null){
		Ismoving = false;
		anim.SetFloat ("Speed", 0);
	}
}

}

  1. afaik, Input.GetAxis never returns null (unless maybe when said axis doesn’t exist at all). When the axes get no input, they should be zero. so the condition is wrong and to correct it, you need to change it to

if(Input.GetAxis(“Horizontal”) == 0 && Input.GetAxis(“Vertical”) == 0)

  1. secondly, other than that, code doesn’t seem to have anything outright wrong with it, so I’d check the Mecanim state machine, animation transition settings and conditions, as these errors are usually either there, or arise from incorrect interaction of code and the state machine settings.

  2. Nothing more can be inferred from the sparse info you’ve provided.