Hello Guest

Author Topic: Segmented Sprites - Layering issues!  (Read 3575 times)

iamfeneq

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Segmented Sprites - Layering issues!
« on: December 30, 2012, 09:28:11 am »
Hey there!

Purchased 2DTK about 2 days ago and so far I'm loving it. 2DTK seems to take care of layering sprites automatically, in that the sprites won't sit on the same Z causing the mesh/texture to start flickering. That's good. Problem now is that with segmented sprites (as seen in the spider video found here: http://www.youtube.com/watch?v=xnmCtz4VJbY) the segmented sprite pieces are not layering together! Simply moving the parent object on the Z-axis does work but seeing as I'm going to be spawning many of these guys and the AI will control their position (in which they will sit on top of each other) I will need some way to dynamically move their z position. How does 2DTK manage this sort of layering and can I somehow adapt it to my segmented sprites?

Here are some screens:

Issue:
 

How I want them to look:
 

Would be nice if I can get them to work like regular sprites but if not I'll just write some code to spawn them on a different position on z. Maybes that's what I should be doing anyways...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Segmented Sprites - Layering issues!
« Reply #1 on: December 30, 2012, 09:47:09 am »
Hi,

By positioning at arbitrary z values, there is no way to tell a sprite is a part of another. As such it is much easier, and more efficient, to simply sort them by z in the order you wish them to appear in. With a regular ortho camera, there should be no issues in doing this.