Handling animations on sprites that involve axis...

I have a 2d sprite with four animation cycles, each 4 sprites long: “MoveUp”, “MoveDown”, “MoveLeft” and “MoveRight”. Now, I am using GetAxis to allow my movement (top-down RPG style) to take place. I am testing this with my MoveUp animation, however the sprite seems to play it when it is moving up or down. Can I not limit this to when it is only moving upwards?

I have an Animator set up with the state WalkUp, that plays that animation when the parameter “Speed” is higher than “0.01”.

Here is my script:

using UnityEngine;
using System.Collections;

public class MoveMachine : MonoBehaviour {
	public float maxSpeed = 10f;
	Animator anim;
	// Use this for initialization
	void Start () {
		anim = GetComponent<Animator>();
	// Update is called once per frame
	void Update () {
		float moveLR = Input.GetAxis ("Horizontal");
		float moveUD = Input.GetAxis ("Vertical");
		anim.SetFloat ("Speed", Mathf.Abs(moveUD));
		rigidbody2D.velocity = new Vector2 (moveUD * maxSpeed, rigidbody2D.velocity.y);
		rigidbody2D.velocity = new Vector2 (moveLR * maxSpeed, rigidbody2D.velocity.x);

I need urgent help with this issue as soon as possible please.

what i meant was ,if you want to play the animation only once(like only when going up)
,so make a bool parameter to your jump animation like "public bool isJumping;’
know that if a body is jumping then its y axis velocity will be positive,
so check if the body’s y axis velocity is positive or not…
if its positive then set the isJumping boolean property to true…

if(rigidbody2d.velocity.y > 0.01f)

if you have any going down animation just know that y axis velocity will be negative while going down