- Home /
2D walking over/under objects
Hi all, in the first image you can see that my sprite walks over the top of the tree instead of under it, this is easy to fix however doing so with my method of changing the trees Z position causes the player to move underneath the trunk as shown in the second image.
How can I fix this so that the player can be seen while walking past the trunk but is hidden by the rest of the tree when walking behind it? thanks.
Answer by MalachiteBR · Aug 07, 2015 at 11:29 AM
I assume you are trying to make some depth.
In your character script you should change the z position of the character while it gets closer or farther.
Also put some colliders on the tree root so your character don't pass through it.
I did this but for the tress themselves ins$$anonymous$$d and it works fine :) cheers guys.
Answer by Umresh · Aug 07, 2015 at 07:27 AM
You have to use the sort order for the sprites instead of moving in z axis.
Your answer
Follow this Question
Related Questions
Flipping Sprite on Client/Over Network 0 Answers
[2D] Sprite flickers/is choppy when moving 1 Answer
Sprite Shape not working (need help/suggestions!) 2 Answers
Sprites not drawing, why? 0 Answers
2D Animated Sprite gameplay? 0 Answers