1 Reply Latest reply on Nov 23, 2012 9:00 PM by Sean_Wilson

    Intersect two sprites in the middle

    anjemalo Level 1


      I want to detect when two sprites matched in the middle, what I'm doing now is when any pixel of the origen sprite is on the target sprite then intersect, but can I do it in the center?

      Have any sample?

      thank you very much

        • 1. Re: Intersect two sprites in the middle
          Sean_Wilson Adobe Community Professional

          I presume you're referring to the drag and drop game of your other message. Most of these work by providing a tolerance factor so that if you drop your dragged sprite within say 50 pixels of the exact target then it locks onto its target, otherwise it's moved back to its starting location.


          However, your messages suggests that your target is larger in area than your dragged sprite, so you can examine the #union of their rects. If the union is the same dimension as the larger then the smaller is completely within the larger. Check the docs for rect.union()