Play different animations based on direction character is facing, while following the mouse.

I have a character in a top down game moving as per the motion of the mouse. How do I play the respective animation based on the direction, the character is facing at any moment ? Kindly note that my character sprite is not as if it is being seen from 90 degrees over its head, but as if the character is seen from its’ side. So, I don’t the game object to rotate, but just switch animations based on the direction it is facing.
I tried doing Mathf.Abs to check for Horizontal and Vertical axes but it didn’t work. Here is the code for my character movement based on the movement of the mouse.

	private Vector3 mousePosition;
	public float moveSpeed = 0.1f;
	float speed = 1.0f;

	void Start () {
		Screen.showCursor = false;
		}
		
	void Update () {
		if (Input.GetMouseButton(0)) {
			
			mousePosition = Input.mousePosition;
			mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
			transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
}
}
}

`

vector2 direction = transform.position - mouseposition;

`
Will give you the direction and distance from the character towards the mouseposition.
You can use this to determine where the mouse is in relation to the character.

if you only need to check left/right you can simply check if direction.x is positive or negative. This can also be combined with direction.y to check if the mouse is above or below the character.

BTW: Mathf.abs returns the absolute value of a specified number. So -1 would be 1, and 1 would be 1 also.