Sprite staying on idle animation

Hey guys, in my 2d game I’m trying to get my sprites to use their directional animations when moving. When using the script im working on below it works fine for the downward direction but when the right key is pressed it just sticks in the idle animation and slides across. I tried removing the downward animation and then the issue went away.

But I need to have more than one direction D:

10069-gamegif.gif

void Update () {

    if (Input.GetKey(KeyCode.D)) 
	
		{
        	if (!anim.IsPlaying("walking_right")) 
					{
            			anim.Play("walking_right");
					}
			this.transform.Translate(Vector3.right*0.5f*Time.deltaTime);
		}
	
    if (Input.GetKey(KeyCode.S)) 
	
		{
        	if (!anim.IsPlaying("walking_towards")) 
					{
            			anim.Play("walking_towards");
					}
			this.transform.Translate(Vector3.down*0.5f*Time.deltaTime);
		}
	else
	{
		anim.Play ("idle");
	}
}

}

missing an else :

if ( Input.GetKey(KeyCode.D) ) 
{
    // ....
}
else if ( Input.GetKey(KeyCode.S) ) 
{
    // ....
}
else
{
    // ....
}

or just use if with a return method …

if ( Input.GetKey(KeyCode.D) ) 
{
    // ....
    return;
}

if ( Input.GetKey(KeyCode.S) ) 
{
    // ....
    return;
}

// ....
anim.Play ("idle");