1 Reply Latest reply on Apr 28, 2006 8:20 PM by Newsgroup_User

    depth stuff

    Jimmathy
      how wouldi go about setting up the action script so that if the _y of character is equal to or greater than the _y of tree that the tree is in front of the character, else the character is in front of the tree? Im not sure how to do this please help.
        • 1. Re: depth stuff
          Level 7
          Jimmathy wrote:

          > how wouldi go about setting up the action script so that if the _y of
          > character is equal to or greater than the _y of tree that the tree is in
          > front of the character, else the character is in front of the tree? Im not
          > sure how to do this please help.

          Check the methods "MovieClip.swapDepths" and "MovieClip.getDepth" in your
          actionscript dictionnary.


          You can do something along the line of:

          ======
          checkDepth(char_mc, tree_mc)
          {
          if (char_mc._y >= tree_mc._y)
          {
          if (char_mc.getDepth() < tree_mc.getDepth())
          {
          char_mc.swapDepths(tree_mc);
          }
          }
          else if (char_mc.getDepth() > tree_mc.getDepth())
          {
          char_mc.swapDepths(tree_mc);
          }
          }
          =====

          Tim.