using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FlipLocalXWithRenderer : MonoBehaviour
{
    public SpriteRenderer rendToFollow;
    private float origX;

    void Start()
    {
        origX = transform.localPosition.x;
    }

    void Update()
    {
        if(rendToFollow.flipX)
        {
            transform.localPosition = new Vector3(-origX, transform.localPosition.y, transform.localPosition.z);
        }
        else
        {
            transform.localPosition = new Vector3(origX, transform.localPosition.y, transform.localPosition.z);
        }
    }
}
