2 Replies Latest reply on Jul 7, 2011 5:02 AM by McbainGames11

    3 object hit test help

    McbainGames11 Level 2

      hey ,

       

      im trying to make the instance 'red' be removed when all 3 objects have hitten it here is my code:

       

      var hit = 0;

       


      addEventListener(Event.ENTER_FRAME, hittest);
      function hittest(e:Event)
      {
         
      addChild(blue);
      addChild(green);
      addChild(pink);
      addChild(red);
      if(blue.hitTestObject(red))
      {
         
         
         
          removeChild(blue);
          hit+=1;
         
         
      }
      if(green.hitTestObject(red))
      {
         
         
         
          removeChild(green);
          hit+=1;
      }
      if(pink.hitTestObject(red))
      {
         
         
         
          removeChild(pink);
          hit+=1;
         
      }

       


      if(hit >= 3)
      {
         
         
          removeChild(red);
         
         
      }

       


      }

       

       

       

      and theres more code like the drag and drop but thats not an issue so i left it out

       

      please help,

      thanks