1
\$\begingroup\$

I'm using tile maps, and I'm having a difficult time with the concept of walking both in front of things, and behind things and having the layers sort order show properly. Take the image below, I need it to behave like #1 AND #2, so that if you walk behind it, you get that nice layering. However, I also need it to act like #2 when infront of it without looking like #3. Is there some sort of way to make the top of the barrels sort order change depending on if the player is in front of it, or behind it?

I was looking at rule tiles, but that's something else, unless there is some feature about it I do not know of.

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Are you using Unity? If so, don't forget to mention that in your tags. \$\endgroup\$
    – DMGregory
    Apr 13, 2021 at 12:03

1 Answer 1

1
\$\begingroup\$

The image doesn't need to fit into the space where the tile goes. The barrel can be a single tile which extends above it's bounding box. As long as the tile display order draws lower tiles over higher ones, everything should work out. It also means you don't need separate images in your tileset for every different tile your barrel can be in front of.

This works even for very large objects, like archways which span multiple tiles.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .