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

public class BackgroundScript : MonoBehaviour
{
    public float speed;
    public Transform player;
    private void Start()
    {
        speed = 0.5f;
    }



    void Update()
    {
        transform.position += new Vector3(-1, 0, 0) * speed * Time.deltaTime;
        if (transform.position.x - player.position.x <= -15) {
            transform.position = new Vector2(player.position.x + 15f, 0);
        }
        
    }
}