1 Reply Latest reply on Nov 1, 2006 10:11 AM by TimSymons

    hittest on a masked object?

    Level 7

      I am developing a game, which has heads that popup at random from behind two
      hills. the user throws snowballs at the heads. I am using the hittest
      function to test for the collison. the problem i m having is when the heads
      are hidden, the hittest is still coming back as true if the snowball hits
      the area where the head is hidden. does anyone have any suggestions?

      you can see the current version i m having problems with -

      Thanks in advance


        • 1. Re: hittest on a masked object?
          TimSymons Level 1
          I have 2 ideas for you. Not sure how easy they would be to implement in to your current coding.

          1) Use a flag variable that you would set to "true" if the head was visible and "false" when not. Then when using the hitTest() method you could also test to see if the variable was also "true". If it was then it was a hit if not then nothing.

          2) If your mask is a movieclip, the use the hitTest method on the snowball and the head and also on the head and the mask. If they both came back "true" then it would be a hit, otherwise not.