Top-Down Tilemap Character infront and behind objects

Published October 03, 2019
Advertisement

This is a very straight forward method to achieve this effect. The area behind the rock is walk-able and will hide the player in the render order and the front will show the player on-top.

image.png.4361b10a965edabcdfcb17f0173c4555.png

image.png.e7eb2f08bbca7445cc163b8163fac3ec.png

I've been very happy with the way the tilemaps are working in unity, once you get used to it they really make sense. Getting your character to appear in front of and behind objects is done with splitting the sprite in half and putting them on different layers. The important part is adjusting your box collider on your player so they never clip through these objects, this is what we're using for ours:

image.png.c1f84e167fde8e78cc1df32472015f16.png

Our player sprite is 16x32 and I typically split all of my tilemaps into 16x16.

image.png.49e2e0b6e494338ad3bf097dcdf4331b.png

The sprite renderer on the player is important too, the "player" sorting layer is in front of the default layer.

image.png.4ba4c9c3db26c66b1958fe7547013be5.pngimage.thumb.png.2650c2af1e2a970a730035538fc8871d.png

Our bottom layer just needs to be on the default layer and have a collider; just stamp that bottom layer in there.

image.png.b9c1a3765fd49336ad0b95e4cbe99ee6.png

image.thumb.png.db4073e29de0093e3ec00974ed5b1d77.png

Our top layer just needs to be a higher value than our player.

image.png.36c8bbe46a33fd9dffed0d175d232741.png

If you're using tilemaps and you're going for this top-down RPG aesthetic I think you'll get a lot of mileage out of this method to really bring out depth.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement