我已经试着解决这个问题好几个小时了,不管我怎么做,我都想不出来。我游戏中的入口应该在你收集完所有的硬币后被解锁。门户是锁定的,但当我检查一个硬币时,它既不会添加到变量中,也不会删除实例名为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;发布于 2012-03-23 21:27:32
试试这个:
var openportal = 0;
function moveStuff() {
//-Very long code that is working.
}
if (ball_mc.hitTest(coin1._x, coin1._y)) {
_root.removeMovieClip(coin1);
openportal++;
}
if (ball_mc.hitTest(coin2._x, coin2._y)) {
_root.removeMovieClip(coin2);
openportal++;
}
if (ball_mc.hitTest(coin3._x, coin3._y)) {
_root.removeMovieClip(coin3);
openportal++;
}
if (openportal >= 3){
if (goal1_mc.hitTest(ball_mc._x, ball_mc._y)) {
gotoAndStop(2);
}
}
ball_mc.onEnterFrame = moveStuff;https://stackoverflow.com/questions/9839718
复制相似问题