hitTestObject movieclips FAILS
Hello everyone,
i am getting a trouble with the hitTestObject method.
I have three movie clips- p1_mc,p2_mc,ground_mc
lifea and lifeb are dynamic text boxes. They will record the life of players(it is a fighting game)
variables a & b will record which way the players are facing(left(0) , right(1))
But when i test the movie, hitTestobject only works on condi(a boolean variable) and cond(a boolean variable)
*PS: this is a part of my whole actions code.
CODE:
import flash.events.*;
lifea.text='100'
lifeb.text='100'
var a = "1";
var b = "0";
MovieClip(root).addEventListener(Event.ENTER_FRAME,etf);
function etf(e:Event) {
var condit = MovieClip(p2_mc.bk).hitTestObject(p1_mc.a_mc)
if ( condit) {
if (b=="1") {
p2_mc.gotoAndStop(9);
}
if (b=="0") {
p2_mc.gotoAndStop(1);
}
lifea.text= String( Number(lifea.text)-10)
p1_mc.alpha -= 0.1;
}
var cond = (! p2_mc.hitTestObject(ground_mc))
if ( cond ) {
p2_mc.y += 3;
} else {
k.p2up = false;
}
var condi = p1_mc.ak.hitTestObject(p2_mc.b_mc)
if (condi) {
if (a=="1") {
p1_mc.gotoAndStop(1);
}
if (a=="0") {
p1_mc.gotoAndStop(9);
}
lifeb.text= String( Number(lifeb.text)-10)
p2_mc.alpha -= 0.1;
}
var co = (! p1_mc.hitTestObject(ground_mc))
if (co) {
p1_mc.y += 3;
} else {
k.p1up = false;
}
}
