0

我有一个 HitTestObject 会在被子弹击中时删除movieClip(enemy)。

这是代码:

if (hitTestObject(bulletTarget)) {
    //remove this from the stage if it touches a bullet
    removeEventListener(Event.ENTER_FRAME, eFrame);
    _root.removeChild(this);
    //also remove the bullet and its listeners
    _root.bulletContainer.removeChild(bulletTarget);
    bulletTarget.removeListeners();
    //up the score
    _root.score += 5;
}

但不是立即删除它,我希望 Movieclip(enemy) 播放下一帧,这是它爆炸的动画,一旦发生爆炸,它应该被删除。

4

1 回答 1

0

傻我!

我变了

_root.removeChild(this);

this.gotoAndPlay(2);

然后在我的爆炸剪辑结束时我添加了

this.parent.removeChild(this);
于 2012-12-05T09:09:20.207 回答