Using distance instead of hit test...
Code:function doUpDate() { if (Key.isDown(Key.LEFT)) { hero._x -= hero.power; } else if (Key.isDown(Key.RIGHT)) { hero._x += hero.power; } else if (Key.isDown(Key.UP)) { hero._y -= hero.power; } else if (Key.isDown(Key.DOWN)) { hero._y += hero.power; } for (var i in bombs) { mc = bombs[i]; if (mc._currentframe == mc._totalframes) { mc = bombs.splice(i, 1); removeMovieClip(mc); break; } else if (mc._currentframe >= 14 && mc.damage == false) { if (getMDistance(hero, mc)< 60) { mc.damage = true; trace("hit"); } } } } function getMDistance(p1, p2):Number { return Math.abs(p1._x - p2._x) + Math.abs(p1._y - p2._y); }




Reply With Quote