How to fix spite character changing position when turning?

I have a simple movement left and right on my 2d character. My problem is that when it turns/changes direction the character changes position. How can I have my character change direction/turn around while staying in the same position? Any help would be much appreciated!!

using UnityEngine;
using System.Collections;

public class playercontroller : MonoBehaviour {
	public float speedForce= 50f;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
		if(Input.GetKey(KeyCode.A))
		{
			GetComponent<Rigidbody2D>().velocity = new Vector2 (-speedForce,GetComponent<Rigidbody2D>().velocity.y);
			transform.localScale = new Vector3(-1,1,1);
		} else if (Input.GetKey(KeyCode.D))
		{
			GetComponent<Rigidbody2D>().velocity = new Vector2 (speedForce,GetComponent<Rigidbody2D>().velocity.y);
			transform.localScale = new Vector3(1,1,1);
		}
		else
			GetComponent<Rigidbody2D>().velocity = new Vector2 (0,GetComponent<Rigidbody2D>().velocity.y);

	}
}

Worked it out for anyone who may run into a similar issue my object had some animations attached to it that were causing the center point to change.