A basic way to do it is "depth = -y", though it depends on whether you're using depth or layers for your project.
By using depth = -y, you are telling GMS 2 to create multiple layers for each instance that is inserted at such depth, which is very inefficient
(like when you have a lot of instances, for example), although it works, I do not recommend doing this.
What you should do is find a way to, without using many layers (like depth = -y), separate the depth from the instances (automatic depth sorting), there are some tutorials that can help you, like this for example: