Pixelated movement script for enemy makes enemy stop, move, stop, move...

it has something to do with him being out of range, then in range. I have no idea how to fix this…

public class Enemy : MonoBehaviour {

	public GameObject PlayerGet;
	public float StopDistance;
	private float XPos;
	private float YPos;
	public float Speed;

	void Start () {
		XPos = transform.position.x;
		YPos = transform.position.y;
	}

	void Update () {
		transform.position = new Vector2 (XPos, YPos);
		RaycastHit2D HitPoint = Physics2D.Raycast (transform.position, PlayerGet.transform.position - transform.position, 2f);
		if (HitPoint.collider != null)
		{
			if (HitPoint.collider.tag == "Player")
			{
				Invoke ("ChaseInitiation", 1);
			}
			else
			{
				CancelInvoke ("ChaseInitiation");
			}
		}
		else
		{
			CancelInvoke ("Chase");
		}
	}

	void ChaseInitiation () {
		StartCoroutine (Chase ());
	}

	IEnumerator Chase () {
		if (transform.position.x < PlayerGet.transform.position.x - StopDistance)
		{
			XPos += Speed / 32;
		}
		if (transform.position.x > PlayerGet.transform.position.x + StopDistance)
		{
			XPos -= Speed / 32;
		}
		if (transform.position.y < PlayerGet.transform.position.y - StopDistance)
		{
			YPos += Speed / 32;
		}
		if (transform.position.y > PlayerGet.transform.position.y + StopDistance)
		{
			YPos -= Speed / 32;
		}
		yield return new WaitForSeconds (0.25f);
	}
}

I think that your raycast could be hitting other objects before it finds the player, such as a trigger placed in the scene or its own enemy collider. In order to prevent it I recommend you to use the layer mask parameter when you call the raycast method. This way you will ensure that the only GameObject it can hit is the one with the player’s layer, that is to say, the player.

Here you can see how to use layer mask with raycast: