- Home /
2D Bring closest spites to front
Hi there,
I've been creating a 2D unity game, however I have a problem when it comes to bringing the closed sprite to the front. For example, if there is a sprite behind a building it will be behind it, but if it comes closer, it should be able to walk infront of the building, not behind. Is there a way to do this?, The game is 2D top down but feels isometric from the graphics.
I'm not entirely sure if this question makes much sense, if not please say.
Thanks in advance.
Answer by nesis · Mar 09, 2014 at 06:07 PM
The moment you said top down I knew what you meant :p
The trick is to have the top of the building or whatever on a layer further forward than the bottom of the building. A good rule of thumb is if it's higher than the player's head, it goes in front of the player.
:) Thanks for your answer. Its good advice, but how would i go about setting the player or props/buildings in front of the player? code wise.
Thanks alot.
Set the z coordinate of each sprite's position to something greater than the player's z coordinate, and they'll appear in front.
Your answer
Follow this Question
Related Questions
New sprites in 2D projects only? Cannot add in 3D project 0 Answers
Unity for 2D (isometric) pixel art game - how to keep the real size of the sprite in-game? 1 Answer
How to organize sprites 1 Answer
Isometric using 2D sprite 0 Answers
pixel perfect 2d Sprite in 3d world with isometric camera, how to do it right? 1 Answer