3 Replies Latest reply on Feb 28, 2012 7:16 AM by kglad

    hittest on every object on stage

    WitchXHunter Level 1

      Hello there, I would like to know if there's the way to do collision check on every object on the stage,

       

      I know I can do that by

      for(i in _root.shape1.perimeter) { //loop through all opjects in perimeter clip
      point = new Object(); //create a new generic object to hold the coordinates
      point.x = _root.shape1.perimeter[i]._x; //x coordinate
      point.y = _root.shape1.perimeter[i]._y; //y coordinate
      _root.shape1.localToGlobal(point); //convert coordinates from local (within shape1) to global (_root)
      if(this.hitTest(point.x, point.y, true)) { //check for collision between perimeter clip coordinates and shape 2
      hit = true; //make our hit variable true
      }}

      from http://www.kirupa.com/developer/actionscript/advanced_collision.htm

       

       

      but is there a way to do it in this way as such , it track by using

      for(i in _root){

      rpoint= new Object();


      rpoint.x = _root[i]._x; //x coordinate
      rpoint.y = _root[i]._y; //y coordinate

      }

       

      Is there a way to get track of the child(something like ._parent) on _root?

       

       

      and also I have another question

       

       

      http://i1100.photobucket.com/albums/g417/Nortune/rota.png

       

      I want to make the object such that it falls on a rotated platform and land according to it's  angle. I've success fully make it landed according to it's angle before it lands. but the problem here is that, after the landing when I trigger the rotating platform, the object falls when the platform is out of it's hit area. Is there a way such that it will work like a car wiper and wipe the object towards it's direction? Thanks