Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
check the localToGlobal method. DisplayObject - Adobe ActionScript® 3 (AS3 ) API Reference
Find more inspiration, events, and resources on the new Adobe Community
Explore Now