使用相同的数组到下一帧

时间:2015-06-27 10:09:03

标签: arrays actionscript-3

我正在制作游戏,我在第1帧完成了level1。 当我试图使level2到frame2我不知道如何转移我的阵列 到frame2.All其他按钮和功能正在工作(我将eventListeners复制到frame2)但我的敌人在阵列中什么也没做! 非常感谢!!!     import flash.events.Event;

stop();
//variables the helicopters
var enemy1Array:Array = new Array();
    for (var e1:int = numChildren - 1; e1 >= 0; e1--) 
    {
        var child:DisplayObject = getChildAt(e1);
        if (child.name == "enemy1") 
        {
          enemy1Array.push(child);
        }
    }

stage.addEventListener(Event.ENTER_FRAME, allloop);
function allloop(event:Event):void
{
//move the helicopters
for each(var enemy1:Sprite in enemy1Array)
{
   enemy1.x = enemy1.x -= enemy1speed;
   if(enemy1.hitTestObject(defense))
   {
            addChild(explotionbonus3);
            explotionbonus3.gotoAndPlay(2);
            explotionbonus3.x = enemy1.x;
            explotionbonus3.y = enemy1.y;
            enemy1.y = 1000;
            score -=5;
            scoretxt.text = String (score);
   }
}
}

0 个答案:

没有答案
相关问题