我已经尝试解决这个问题几个小时了,无论我做什么我都无法弄清楚。我的游戏中的传送门应该在你收集完所有硬币后解锁。门户已锁定,但是当我通过硬币时,它既不会添加到变量中,也不会通过 coin1 coin2 和 coin 3 的实例名称删除影片剪辑。有人可以帮我吗?
此外,如果删除影片剪辑不需要 _root 我已经尝试过没有它,我知道这不是问题。
var openportal = 0;
function moveStuff() {
//-Very long code that is working.
}
if (ball_mc.hitTest(coin1._x, coin1._y)) {
removeMovieClip(_root.coin1);
var openportal = openportal + 1;
}
if (ball_mc.hitTest(coin2._x, coin2._y)) {
removeMovieClip(_root.coin2);
var openportal = openportal + 1;
}
if (ball_mc.hitTest(coin3._x, coin3._y)) {
removeMovieClip(_root.coin3);
var openportal = openportal + 1;
}
if (openportal >= 3){
if (goal1_mc.hitTest(ball_mc._x, ball_mc._y)) {
gotoAndStop(2);
}
}
ball_mc.onEnterFrame = moveStuff;