0 votes

I am trying to make a 2D top-down view game. My problem is the following (I am trying my best to describe it): I am using a tilemap for my buildings and a kinematicbody for my player. I want to make my player show up when he passes in front of a building (by being above the tilemap in the z-sorting hierarchy) but hide when he walks along the ceiling, giving the impression of the back wall you cannot see. And so my question is how can I achieve mulitple view options for the same sprite/tilemap? Thanks!

in Engine by (18 points)

1 Answer

+1 vote
Best answer

If you enable Y Sort on your TileMap, map tiles and any children of the tilemap (make the player a child of the map) will draw in order of their Y positions.

by (1,330 points)
selected by

Nice one, thanks! I would like your help in more matter if you could. Tiles from the same tilemap seem to have a hierarchy on their own, meaning that the most right tile is shown first. For example, If I place a house between two trees, the tree to the left will be seen behind the house, but the right one will be seen in front, which seems wrong. Is there any way to control this?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.