home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / planetx.swf / scripts / frame_17 / DoAction_20.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  4.2 KB  |  140 lines

  1. function setuplevel()
  2. {
  3.    _root.state = "paused";
  4.    _root.levelann = "Cave " + level;
  5.    trace("LEVEL START" + level);
  6.    attachMovie("level_announce","tellPlayer",9);
  7.    tellPlayer._x = 320;
  8.    tellPlayer._y = 100;
  9.    background.gotoAndStop(level);
  10.    i = 0;
  11.    while(i < 100)
  12.    {
  13.       removeMovieClip(eval("landScape.mine" + i));
  14.       removeMovieClip(eval("landScape.fuelPad" + i));
  15.       removeMovieClip(eval("landScape.volcano" + i));
  16.       removeMovieClip(eval("landScape.escapePod" + i));
  17.       i++;
  18.    }
  19.    landScape.attachMovie("thrustClip","thrustClip",100);
  20.    landScape.thrustClip.thrustRightClip._visible = false;
  21.    landScape.thrustClip.thrustLeftClip._visible = false;
  22.    landScape.thrustClip.thrustUpClip._visible = false;
  23.    landScape.thrustClip.thrustDownClip._visible = false;
  24.    playerState = "normal";
  25.    currentLevelquota = 0;
  26.    currentLevelCollect = 0;
  27.    gameArray = eval("level" + level + "data");
  28.    enemyLevel = _root.enemyLevelStart;
  29.    trace(enemyLevel);
  30.    i = 0;
  31.    while(i < gameArray.length)
  32.    {
  33.       ran = gameArray[i];
  34.       if(ran == "player")
  35.       {
  36.          trace(ran);
  37.          px = gameArray[i + 1];
  38.          py = gameArray[i + 2];
  39.          playerXspeed = 0;
  40.          playerYspeed = 0.1;
  41.          attachMovie("player","player",7);
  42.          player._x = 320;
  43.          player._y = 240;
  44.       }
  45.       if(ran == "exit")
  46.       {
  47.          landScape.attachMovie("exitPad","exit" + enemyLevel,enemyLevel);
  48.          with(eval("landScape.exit" + enemyLevel))
  49.          {
  50.             _x = gameArray[i + 1];
  51.             _y = gameArray[i + 2];
  52.          }
  53.       }
  54.       if(ran == "miniCollect")
  55.       {
  56.          landScape.attachMovie("miniCollect","miniCollect" + enemyLevel,enemyLevel);
  57.          tempType = gameArray[i + 3];
  58.          if(tempType == 0)
  59.          {
  60.             tempType = random(3) + 1;
  61.          }
  62.          with(eval("landScape.miniCollect" + enemyLevel))
  63.          {
  64.             _x = gameArray[i + 1];
  65.             _y = gameArray[i + 2];
  66.             gotoAndStop(tempType);
  67.             clip.typeOf = tempType;
  68.          }
  69.       }
  70.       if(ran == "mine")
  71.       {
  72.          landScape.attachMovie("mine_Clip","mine" + enemyLevel,enemyLevel);
  73.          with(eval("landScape.mine" + enemyLevel))
  74.          {
  75.             _x = gameArray[i + 1];
  76.             _y = gameArray[i + 2];
  77.             clip.moveType = gameArray[i + 3];
  78.          }
  79.       }
  80.       if(ran == "volcano")
  81.       {
  82.          landScape.attachMovie("volcano","volcano" + enemyLevel,enemyLevel);
  83.          with(eval("landScape.volcano" + enemyLevel))
  84.          {
  85.             _x = gameArray[i + 1];
  86.             _y = gameArray[i + 2];
  87.             clip.moveType = gameArray[i + 3];
  88.          }
  89.       }
  90.       if(ran == "escapePod")
  91.       {
  92.          landScape.attachMovie("escapePod","escapePod" + enemyLevel,enemyLevel);
  93.          with(eval("landScape.escapePod" + enemyLevel))
  94.          {
  95.             _x = gameArray[i + 1];
  96.             _y = gameArray[i + 2];
  97.             currentLevelquota++;
  98.          }
  99.       }
  100.       if(ran == "fuelPad")
  101.       {
  102.          landScape.attachMovie("fuelPad","fuelPad" + enemyLevel,enemyLevel);
  103.          with(eval("landScape.fuelPad" + enemyLevel))
  104.          {
  105.             _x = gameArray[i + 1];
  106.             _y = gameArray[i + 2];
  107.          }
  108.       }
  109.       if(ran == "shieldCharge")
  110.       {
  111.          landScape.attachMovie("shieldCharge","shieldCharge" + enemyLevel,enemyLevel);
  112.          with(eval("landScape.shieldCharge" + enemyLevel))
  113.          {
  114.             _x = gameArray[i + 1];
  115.             _y = gameArray[i + 2];
  116.          }
  117.       }
  118.       enemyLevel++;
  119.       i += 4;
  120.    }
  121.    currentLevelCollect = 0;
  122.    remainObjects = currentLevelquota - currentLevelCollect;
  123.    trace("remainObjects = " + remainObjects);
  124.    landScape.gotoAndStop(level + 1);
  125.    landScape._x = - (px - 320);
  126.    landScape._y = - (py - 240);
  127.    landScape._xscale = 100;
  128.    landScape._yscale = 100;
  129.    playmusic();
  130.    thrusting = 0;
  131.    leftThrust = 0;
  132.    rightThrust = 0;
  133.    addThrust = 5;
  134.    playerFuel = 100;
  135.    playerHealth = 100;
  136.    this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
  137.    this.fuelMeter_clip.fuel_bar_clip._xscale = playerFuel;
  138.    lowFuelSnd_played = 0;
  139. }
  140.