# Change Sprite's Position

I have a sprite attached to the player like an accessory and it flips along with the player when moving in the opposite direction. However, due to the player being a dog, when flipped, the accessory only flips and the position doesn't change. I want to move that sprite to a bit left every time the player flips.

if (Input.GetAxis("Horizontal") < 0)
{ spriteRnderer.flipX = true; bandanaRenderer.flipX = true; }
else if (Input.GetAxis("Horizontal") > 0)
{ spriteRnderer.flipX = false; bandanaRenderer.flipX = false; }
transform.position += new Vector3(Input.GetAxis("Horizontal") * Time.deltaTime * speed, 0);
animator.SetFloat("Speed",Mathf.Abs(Input.GetAxis("Horizontal") * Time.deltaTime * speed));
jumpSpeed = 0;

• Please don't post sourcecode as images. Just copy&paste it as text from your development environment, and add 4 spaces in front of each line so it appears as a code block with syntax highlighting. That makes it possible for people to directly copy&paste from your code into their answers. Sep 29 '21 at 10:40

When the horizontal axis is < 0, just rotate the player instead of flipping like this:

if (Input.GetAxis("Horizontal") < 0)
{
transform.eulerAngles = new Vector3(0,180,0);
}
else if (Input.GetAxis("Horizontal") > 0)
{
transform.eulerAngles = new Vector3(0,0,0);
}


The same applies to any sprite.