home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / Titans / robin.swf / scripts / DefineSprite_314_xcontroller / frame_4 / DoAction.as
Encoding:
Text File  |  2006-01-05  |  1.8 KB  |  101 lines

  1. movieclip.prototype.cekbots = function()
  2. {
  3.    var len = bot.length;
  4.    var i = 0;
  5.    while(i < len)
  6.    {
  7.       if(r[bot[i]].energy <= 0)
  8.       {
  9.          this.bot.removevalue(bot[i]);
  10.          this.botran = this.bot.copy();
  11.          if(this.bot.length == 1)
  12.          {
  13.             r[bot[0]].melastbot = 1;
  14.             r[bot[0]].energy += 5;
  15.          }
  16.       }
  17.       i++;
  18.    }
  19. };
  20. d = 30;
  21. shotdelay = 12;
  22. sd = shotdelay;
  23. cekbots();
  24. if(!botran.length)
  25. {
  26.    botran = bot.copy();
  27.    botran.randomize();
  28. }
  29. oldran = ran;
  30. ran = botran.pop();
  31. if(oldran == ran and bot.length > 1)
  32. {
  33.    if(bot.length > 1)
  34.    {
  35.       oldran = ran;
  36.       ran = botran.pop();
  37.    }
  38. }
  39. r[ran].rx.gotoAndStop("in");
  40. onenterframe = function()
  41. {
  42.    cekbots();
  43.    if(r[ran].energy <= 0)
  44.    {
  45.       d = -50;
  46.    }
  47.    d--;
  48.    if(d == 0)
  49.    {
  50.       r.attachmovie("xbul","eb" + r.ed,r.ed);
  51.       r["eb" + r.ed]._x = r[ran]._x - 20;
  52.       r["eb" + r.ed]._y = r[ran]._y - 60;
  53.       r["eb" + r.ed].dep = r.ed;
  54.       r.ebul.push("eb" + r.ed);
  55.       r.ed = r.ed + 1;
  56.    }
  57.    else if(d == 10)
  58.    {
  59.       r[ran].rx.gotoAndStop("attack");
  60.    }
  61.    else if(d == -10)
  62.    {
  63.       r[ran].rx.gotoAndStop("stand");
  64.    }
  65.    else if(d < -30)
  66.    {
  67.       if(bot.length > 1)
  68.       {
  69.          r[ran].rx.gotoAndStop("out");
  70.          delete onenterframe;
  71.          play();
  72.       }
  73.       else if(bot.length == 1)
  74.       {
  75.          if(ran == bot[0])
  76.          {
  77.             d = 20;
  78.          }
  79.          else
  80.          {
  81.             r[ran].rx.gotoAndStop("out");
  82.             delete onenterframe;
  83.             play();
  84.          }
  85.       }
  86.       else
  87.       {
  88.          r.score += 50 * r.point;
  89.          delete onenterframe;
  90.          stop();
  91.       }
  92.    }
  93.    sd--;
  94.    if(!sd)
  95.    {
  96.       sd = shotdelay;
  97.       r[bot[random(5)]].shoot = 1;
  98.    }
  99. };
  100. stop();
  101.