HitTest Problem
I have a hitTest that isn't working. It used to work, then I changed some other code, and now it doesn't work but I can't work out why. Here is the offending code
private function collisionTest(object:BaseObject) {
//trace ("com.poosk.BaseObject.collisionTest");
// Temp Code
trace(getMC());
trace(object.getMC());
if (getMC()._y >= object.getMC()._y &&
getMC()._y < object.getMC()._y + object.getMC()._height &&
getMC()._x >= object.getMC()._x &&
getMC()._x < object.getMC()._x + object.getMC()._width) {
trace("Bang XY");
}
// End of temp code
if ( getMC().hitTest(object.getMC())) {
trace("Bang");
}
}
The Temp Code I put in does detect the colision so I'm sure that the software is running the check on the right objects. Yet the hitTest is not picking up the collision. I assuming the problem is something to do with how I create or use the movieclips themselves but I have no idea what to start looking for. Everything appears on the screen correctly and behaves as expected so I am at a complete loss. Any suggestions?
private function collisionTest(object:BaseObject) {
//trace ("com.poosk.BaseObject.collisionTest");
// Temp Code
trace(getMC());
trace(object.getMC());
if (getMC()._y >= object.getMC()._y &&
getMC()._y < object.getMC()._y + object.getMC()._height &&
getMC()._x >= object.getMC()._x &&
getMC()._x < object.getMC()._x + object.getMC()._width) {
trace("Bang XY");
}
// End of temp code
if ( getMC().hitTest(object.getMC())) {
trace("Bang");
}
}
The Temp Code I put in does detect the colision so I'm sure that the software is running the check on the right objects. Yet the hitTest is not picking up the collision. I assuming the problem is something to do with how I create or use the movieclips themselves but I have no idea what to start looking for. Everything appears on the screen correctly and behaves as expected so I am at a complete loss. Any suggestions?
