AI enemy following the player without rotations in 2D game

I have the following code, but my enemy is rotating. How can I stop that?

using UnityEngine;
using System.Collections;

public class follow_player : MonoBehaviour {

Transform target; //the enemy's target
float moveSpeed = 3.0f; //move speed
float rotationSpeed = 3.0f; //speed of turning

Transform myTransform; //current transform data of this enemy

void Awake()
{
	myTransform = transform; //cache transform data for easy access/preformance
}

void Start()
{
	target = GameObject.FindWithTag("Player").transform; //target the player
	
}

void Update () {
	//rotate to look at the player
	myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
	                                        Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
	
	//move towards the player
	myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
	
	
}

}

You are using a LookRotation that affects all axis. Make a new vector that is target.position - myTransform.position, and set the axis that you don’t want the enemy to rotate on as myTransform.position.x/y/z (depending on the axis you want to cancel rotation on).