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

public class Layers : MonoBehaviour{
    public GameObject sprite;
    public Rigidbody2D rb;
    public void Layer(){
        SpriteRenderer[] renderers = FindObjectsOfType<SpriteRenderer>();
        foreach(SpriteRenderer renderer in renderers){
            if(renderer.sortingLayerName == "Objects"){
                renderer.sortingOrder = (int)(renderer.transform.position.y * -100);
            }
        }
    }
}