guys, not sure if anyone has done this yet, but i recently had a need to parent actors, and discovered the issues with child actors receiving zdepth level relative to the parent..
I have had a play around and this is what I discovered.
1. zdepth appears to be only accurate to two decimal places.. eg: .998 and point 999 are equal (I could be wrong here)
2. a child will always receive a zdepth "higher" then the parent, (the child will always be on top of the parent)
3. two children on the same parent can be zdepthed to each other ( but not the parent)
(the child actors will always be on top of the parent, but can be layered individually amongst themselves.
4. the zdepth of individiual children has NO effect on any other actor, all other actors will use the parents zdepth,
(To all other actors the children will appear the same zdepth as the parent. )
example case
actor 1 is a character
actor 2 is the gun which is parented to actor 1
actor 3 is ammo which is parented to actor 1
ammo and gun can be separately zdepthed so that either the gun or the ammo are on top, BUT neither can be below the parent actor.
if the parent actors zdepth is .59 - the parent and ALL children will be below ANY other actor with a zdepth of .60 or above
and, the parent and ALL children will always be above any other actor with a zdepth of .58 or below - regardless of the individual settings of the child actors..
example: the character holding a gun and ammo ( parent and children) will always move "together", behind/ or in front of trees/buildings etc even if the childs zdepth is set to 1 or 0,
(only the parent zdepth counts.)
in other words..
always make the sprite you want to be at the back of the parenting structure the ONLY parent ( AND the one controlling the zdepth interection with the rest of the game) (see note), and make all other connected actors ( guns ammo etc) children of the same parent this way you can adjust the individual layers of the children.
I hope that makes sense and helps someone - and/or if there is a tutorial already on this please let me know
(and/or if i got it wrong)
note: when i say "always make the parent the ONLY parent".. i mean in general... (for example there may be times you want to parent another group of "already parented sprites" to an existing parent)
feral