remove array when touch a movieClip (hitTestObject)
Hi all,
I'm making an AS3 platform game.
My player can shoot bullets. If a bullet touch an enemy, it will be removed.
for (var j:int = 0; j < bulletList.length; j++) // for each bullet in the bulletList
{
if (enemies.mc.hitTestObject(bulletList
) ){ trace("Bullet and Enemy are colliding");
enemyDie(i)
bulletList
.removeSelf(); }
But now I'd like to remove the bullet if it touch a movieClip on the stage (with the instance "tree_mc"). And I can't figure out how to do so...
I've tried this :
var tree_mc;
for (var j:int = 0; j < bulletList.length; j++){
if(tree_mc.hitTestObject(bulletList
)){ trace("bullet hit tree");
}
But it's not working.
Do you know how I can do that ?
Thank you