home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / pendekar.swf / scripts / DefineSprite_450_level01 / frame_1 / DoAction.as
Text File  |  2006-05-08  |  4KB  |  176 lines

  1. function init()
  2. {
  3.    if(runOnce)
  4.    {
  5.       return undefined;
  6.    }
  7.    this.runOnce = true;
  8.    trace("> Initializing Level 01...");
  9.    tellTarget(_parent)
  10.    {
  11.       setStage("The Attack",400,"flr_soil","env_village","bg_mountain");
  12.       addPlayer(_root.player1);
  13.       if(_root.music)
  14.       {
  15.          music = new Sound();
  16.          music.attachSound("music04.wav");
  17.          music.start(0,9999);
  18.       }
  19.       registerObject("oPole",100);
  20.       registerObject("oWeaponGolok",200);
  21.       registerObject("oPole",500);
  22.       registerObject("oPole",600);
  23.       registerObject("oPole",1000);
  24.       registerObject("oPole",1200);
  25.       registerObject("oPole",2000);
  26.       registerObject("oPole",2300);
  27.       registerObject("oPole",2600);
  28.       registerObject("oWeaponGolok",3000);
  29.       registerObject("oPole",4000);
  30.       registerObject("oPole",4100);
  31.       registerObject("oPole",4200);
  32.       registerObject("oPole",4300);
  33.       registerObject("oPole",5000);
  34.    }
  35. }
  36. function checkPoint(cp)
  37. {
  38.    _parent.isScroll = false;
  39.    switch(cp)
  40.    {
  41.       case 0:
  42.          pack01();
  43.          break;
  44.       case 1:
  45.          pack02();
  46.          break;
  47.       case 2:
  48.          pack03();
  49.          break;
  50.       case 3:
  51.          pack04();
  52.          break;
  53.       case 4:
  54.          boss();
  55.          break;
  56.       default:
  57.          trace("err: Checkpoint not specified!");
  58.    }
  59. }
  60. function pack01()
  61. {
  62.    tellTarget(_parent)
  63.    {
  64.       if(bodyCount == 0)
  65.       {
  66.          spawnObject("eThug01",stageWidth - 20);
  67.       }
  68.       else if(bodyCount >= 1)
  69.       {
  70.          hud.goSign.play();
  71.          bodyCount = 0;
  72.          isScroll = true;
  73.          stageLength += 800;
  74.          cp++;
  75.       }
  76.    }
  77. }
  78. function pack02()
  79. {
  80.    tellTarget(_parent)
  81.    {
  82.       if(bodyCount == 0)
  83.       {
  84.          spawnObject("eThug01",stageWidth - 20);
  85.       }
  86.       else if(bodyCount == 1)
  87.       {
  88.          spawnObject("eThug01",stageWidth - 20);
  89.          spawnObject("eThug01",20);
  90.       }
  91.       else if(bodyCount >= 3)
  92.       {
  93.          hud.goSign.play();
  94.          bodyCount = 0;
  95.          isScroll = true;
  96.          stageLength += 800;
  97.          cp++;
  98.       }
  99.    }
  100. }
  101. function pack03()
  102. {
  103.    tellTarget(_parent)
  104.    {
  105.       if(bodyCount == 0)
  106.       {
  107.          spawnObject("eThug01",stageWidth - 20);
  108.          spawnObject("eThug01",20);
  109.       }
  110.       else if(bodyCount == 2)
  111.       {
  112.          spawnObject("eThug01",stageWidth - 20);
  113.          spawnObject("eThug01",20);
  114.       }
  115.       else if(bodyCount >= 4)
  116.       {
  117.          hud.goSign.play();
  118.          bodyCount = 0;
  119.          isScroll = true;
  120.          stageLength += 800;
  121.          cp++;
  122.       }
  123.    }
  124. }
  125. function pack04()
  126. {
  127.    tellTarget(_parent)
  128.    {
  129.       if(bodyCount == 0)
  130.       {
  131.          spawnObject("eThug01",stageWidth - 20);
  132.          spawnObject("eThug01",20);
  133.       }
  134.       else if(bodyCount == 2)
  135.       {
  136.          spawnObject("eThug01",stageWidth - 20);
  137.          spawnObject("eThug01",20);
  138.       }
  139.       else if(bodyCount >= 4)
  140.       {
  141.          hud.goSign.play();
  142.          bodyCount = 0;
  143.          isScroll = true;
  144.          stageLength += 800;
  145.          cp++;
  146.       }
  147.    }
  148. }
  149. function boss()
  150. {
  151.    tellTarget(_parent)
  152.    {
  153.       if(bodyCount == 0)
  154.       {
  155.          dimmer.dim(50);
  156.          dimmer.lock = true;
  157.          hud.bossSign.play();
  158.          if(_root.music)
  159.          {
  160.             music.stop("music04.wav");
  161.             music.attachSound("music07.wav");
  162.             music.start(0,9999);
  163.          }
  164.          spawnObject("eJagoan01",stageWidth - 20);
  165.       }
  166.       else if(bodyCount == 1)
  167.       {
  168.          bodyCount = 0;
  169.          music.stop("music07.wav");
  170.          _root.movieName = "stageClear";
  171.          _root.gotoAndStop("movies");
  172.       }
  173.    }
  174. }
  175. this.onLoad = init();
  176.