Hello Guest

Author Topic: Layering Sprites  (Read 3915 times)

tyrannosaur_jet

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Layering Sprites
« on: November 15, 2012, 05:46:26 am »
I'm trying to implement a system where sprites can be placed on layers -- by which I mean traditional layers sorted by z-index, determining what order objects appear in front of each other, not layers in the Unity sense.

I've had success just changing the Z value on the Transform of every sprite, but eventually, things just stop colliding. It seems like any colliders on tk2dSprites are scripted so their Z size always changes to 0.2, and if I keep increasing the Z transform of things, they go out of range really quickly.

Is there a better method for handling this than just by setting the Z transform of sprites, like I'm doing? And is there a reason why tk2d sets the Z size of its colliders to 0.2? Assuming there's not a reason, is there a way to change that?

Thanks for reading!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Layering Sprites
« Reply #1 on: November 15, 2012, 10:37:52 am »
There is absolutely no reason apart from I had to pick some default number and 0.2 fit with the game we were working on at the time the decision was made. You can change it to anything you'd like in the sprite collection editor.
http://unikronsoftware.com/2dtoolkit/doc/reference/sprite_collection.html

The parameter you want is collider depth.

tyrannosaur_jet

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Layering Sprites
« Reply #2 on: November 16, 2012, 04:04:05 pm »
Awesome. Thanks so much!