2012-03-23 2 views
0

저는 몇 시간 동안이 문제를 해결하기 위해 노력해 왔으며, 무엇을해도 문제를 해결할 수 없습니다. 내 게임의 포털은 모든 동전을 수집 한 후에 잠금 해제되어야한다고 가정합니다. 포털은 잠긴 상태이지만 동전을 가면 변수에 추가되거나 인스턴스 이름이 coin1 인 coin2와 coin2로 동영상 클립이 제거되지 않습니다. 누군가 나를 도울 수 있습니까?변수에 추가하고 무비 클립을 제거하는 Flash as2

동영상을 삭제할 필요가없는 경우 _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; 

답변

0

이 시도 :

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; 
+0

, 감사합니다 순전히! 내가 게시 한 후에 openportal ++을 알아 냈지만 결코 _root가 있다고 생각하지 않았습니다. removemovieclip 전에. –

관련 문제