我正在创建游戏,当一个对象滚过另一个对象时,该对象消失,当它消失时,从舞台上计算剩余对象数量的事物中取出 1;但是,我想要它,以便当它等于零时它会进入一个新场景。到目前为止,这是我的代码:
var nObjects:Number = 5;
An.addEventListener( Event.ENTER_FRAME, handleCollision4)
function handleCollision4( e:Event ):void
{
if(An.hitTestObject(Octo)){
An.addEventListener(MouseEvent.MOUSE_UP, onStopDrag4);
function onStopDrag4(e:MouseEvent):void {
e.target.StopDrag;
if(An.hitTestObject(Octo)){
removeChild(MovieClip(Octo));
nObjects--;
trace(nObjects)
myText.text = String(nObjects);
}
}
//there are five of these when they are all deleted nObjects does equal zero
if (nObjects==0);
{
gotoAndStop(1, "Scene 3");
}