Draw things on top each other - Depth sorting [Game Maker | Basics]

preview_player
Показать описание
This basics video tutorial shows you how to depth sort (depth system) in GameMaker.

Things feel natural if they are being draw correctly. Image a stack of cards and it is obvious that the top card would be visible to you. So what we do is to check where the instances are and sort them to their own depth (or their own layer so to say) according to their y position in the room. We cluster all the instances into a parent object and swap their current depth to their -y value. We do that with the "with" statement that allows use to go through all the instances and swap their own depth. That's it!

Advanced version of controlling depth:

(Free) Art shown in the project and in video thumbnail:
Ansimuz CC0

👑 Support me and get fresh game art and game maker projects every month:

Follow me on:

CHAPTERS
-------------------------------------------------------------------------------------------------------
0:00 What we will do
0:59 Subscribe
1:11 Theory of depth and how things are being draw
2:03 Depth sorting
2:37 Grouping instances into a parent object to sort
3:44 Pitfalls of this depth sorting
Рекомендации по теме
Комментарии
Автор

You legend, thanks for showing how easy this is.

AdamBarkerThe
Автор

Sorry for the super late question, but if i used this inside a house or something, would i need to create a different object for each piece of furniture?

zhael
Автор

love you man this helped me so much with the grass and weapons cus my weapon was glitching through my character and the grass but now its working

Steavej
Автор

Basically, it use y cord of all object (or their bbox_bottom ) to sort them into different layers

tiqosc
Автор

How to make Sequence depth above the other object with -y?

I have make transition with Sequence but the other objecr always on top the Sequence layer

archerxd
Автор

Wait, if I have a layer with tiles that should always be in front of the player, the player occurs in front of it. How do I fix this? Is there any possibility to change the depth in only one layer?

mikulas_hampl
Автор

Do you think you can make a more detailed video like the one that FriendlyCosmonaut did? It would help a lot and I like the way you explain in your videos.

thehllowknght
Автор

I don't know if it's just to provoke people or if it's serious... but they never tell what happens when the instances are at the same depth.
well, I'll tell you. a transparent box appears and one of the instances disappears.
as long as there are no more depth values ​​like -1.01, -1.02..., just -1, -2... for example, one of you will disappear eventually. It can be 2 enemies at the same depth and position or yourself.

herimito
Автор

I thought we cant use depth = -y anymore?

shylvia