Hello Guest

Author Topic: Equipped Character Items & Z-Depth  (Read 4111 times)

Majicpanda

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 62
    • View Profile
Equipped Character Items & Z-Depth
« on: October 11, 2013, 01:49:39 am »
I have an RPG type game and characters laid out like the following:

Main Body sprite - z=0
Head equip item - z=-.2
Chest item - z=-.1
mainhand item - z=.1
Offhand item - z=-.3

This all works great except obviously when characters start walking among each other since up to 4 can be on the screen at once and then as you can expect very weird things happen visually with all these depths weaving between each other.

Is there any other better way to do this?

Takeo Kurita

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Equipped Character Items & Z-Depth
« Reply #1 on: October 11, 2013, 08:05:40 am »
You can just put the different characters on different z-depths, too. Like 0, 1, 2, 3. That way, the mainhand items would be at 0.1, 1.1, 2.1, 3.1, for example.

Majicpanda

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 62
    • View Profile
Re: Equipped Character Items & Z-Depth
« Reply #2 on: October 11, 2013, 07:27:59 pm »
This is what I've already done, but if a character moves "down" in the 2d area then they technically need to be rendered on a different Z, so I guess that means I need to have all my characters current Z's being tracked and control some method of changing it when they need to render in front.

http://www.2d-x.com/wp-content/uploads/2011/04/desertbattle.jpg

That's a good example of what I'm doing.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Equipped Character Items & Z-Depth
« Reply #3 on: October 11, 2013, 09:34:06 pm »
That sounds like a sensible solution. Alternatively, if you have a skinned mesh you can have everything draw in one go. But its easier to manage the z yourself.