简体   繁体   English

Unity 2d 自顶向下 RPG 风格,如何通过图层顺序排序处理 tilemaps

[英]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.我想制作一个自上而下设置的 2d 像素游戏。 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.正如我之前所说,我已经对此进行了一段时间的试验,并且我尝试使用包含 2x2 模式中的 4 个精灵的单个对象来计算一个大精灵。 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.我还调整了透明度排序模式和轴,使用了瓷砖贴图渲染模式的差异等。如果我只使用 1 个瓷砖大的精灵,图层排序将完美地工作,所以基本上只有小石头和盒子才能工作在最终结果中。

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.我很想知道处理图层顺序排序的最佳方法是在哪些地方使用 2x2 大瓷砖(例如树木、大石头、甚至房屋),以及最好的工作流程是什么。

The best way to do this, would be to create a main grid containing several Tilemaps.最好的方法是创建一个包含多个 Tilemap 的主网格。 Then set each of the Tilemaps to a certain layer, the higher the layer the more priority it has over other Tilemaps.然后将每个 Tilemaps 设置为某个层,层越高,它比其他 Tilemaps 的优先级越高。 Resulting in the Tilemap with the highest priority being displayed ontop of all others.导致具有最高优先级的 Tilemap 显示在所有其他人之上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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