Skip to main content
Participant
February 2, 2019
Question

hitTestPoint, how can i put the point of a movieCLip that is inside another.

  • February 2, 2019
  • 1 reply
  • 180 views

function coli(ob1, ob2){

if(ob2.hitTestPoint(ob1.bd.la.ha.x, ob1.bd.la.ha.y, true))

    t.text = String(time);

   }

ob1 and ob2 is given by a MovieClip as the parameter, and .bd(body), .la(left arm), .ha(hookarm) is as well MovieClips, but inside of another one(what i like to call "sons"). that function is called in a ENTER_FRAME function called main().

In this code, the colision isn't working, and i think that is due the .x and .y that the MC obtain when is "son" of another one, their (0,0) coordinates is based on their  "father's" X and Y.  I tried to create a mc called p(i know that i could create a object of the Point Class, but i don't know how to use it) that receive the sum X and Y of the Mcs of ob  (ob1 + ob1.bd + ob1.bd.la + ob1.bd.la.ha)  in a ENTER_FRAME based function, but that doesn't do the p stay in the same postion of the ob1.bd.la.ha. What can i do?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 3, 2019