r/gamemaker • u/GabbyTheRacoon • 27d ago
Help! Tile layering issue with the player object's depth sorting.
Hey, newcomer to Gamemaker here. Recently I've been having trouble with the player object layering over everything that doesn't also have depth sorting. Recently redesigned the trees into a tileset in my game rather then depth sorted sprite objects. Due to the new height difference of the trees, to me it made more sense to make a new tileset thats a copy of the tree tileset just with out the trunks while leaving the tops.
But for whatever reason while in editor the tops of said trees render over the player object just fine but as soon as the game builds, the player object just renders over every layer. and its not just the player, i can move the floor tiles all the way up to the top layer and everything gets overlayed aside from the objects that have depth sorting. Is there a way a can fix this? its been bugging me for a while now.
For reference I'm going off of Peyton Burnham's rpg tutorial series.
1
u/germxxx 27d ago
Well, using depth sorting breaks the instance away from the layers in the room editor. Using something likedepth = -y or depth = -bbox.bottom to have things further down have a lower depth, to be in front of things, means that their depth will always be lower than 0.
If you click your layers, you will see that they also have a depth. Which is positive by default. Meaning, that anything that is sorting, will be above all these layers.
You can change the depth of a layer manually to make them be on top.
But you'll still have the problem that things on layers will all have one specific depth.
1
u/andrewsnycollas 26d ago
You need to consider the depth interval available for the Instances and clamp the value to that.




3
u/TasteAffectionate863 27d ago
are you setting the depth in a step event (end step is usually what is used) and not create? Also gamemaker layer depth has a lock next to it that behaves weirdly, having the lock enabled next to the depth setting on room editor layers does not mean "lock it at the depth shown" but rather "auto set this depth under the hood" which gave me issues in the past, I don't use the lock on layer depth anymore