简体   繁体   中英

Unity 2d top down RPG-style, How to handle tilemaps with layer order sorting

So I've asked this question before, it has to do with tilemaps and layer order sorting. I've gathered more knowledge and understanding of the subject now although i dont know what the right solution. I want to make a 2d pixel game where the setting is top-down. I have borders with collision on the sides of my map, i have tree objects and many more with different dimensions in appearance etc.. the problem lies with the layer order sorting, imagine if the borders were tree leaves and the player should walk under them, and the tree objects in the middle of the map and such, would need to allow the player to walk in front of and behind it, but also on the sides as the player can walk under the tree's leaves a little.

As I've said before, I've been experimenting with this for a while now and i've tried to use single objects containing 4 sprites in a 2x2 pattern to count for one big sprite. I've also tweaked the Transparency Sort Mode and Axis, used the differences of the tilemap render modes etc. The layer sorting would work just perfectly IF I would only use sprites that were 1 tile big, so basically only small rocks and boxes would work in the final result.

I would love to know what the best way to handle layer order sorting is where it would work with 2x2 large tiles (like trees, big rocks, houses even) and what the best workflow for this would be.

The best way to do this, would be to create a main grid containing several Tilemaps. Then set each of the Tilemaps to a certain layer, the higher the layer the more priority it has over other Tilemaps. Resulting in the Tilemap with the highest priority being displayed ontop of all others.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM