home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Puzzle / towerblaster.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2007-03-12  |  1.4 KB  |  70 lines

  1. function randomizeBlocks()
  2. {
  3.    x = 1;
  4.    while(100 >= x)
  5.    {
  6.       set("/:drawBlock" + x,"");
  7.       x++;
  8.    }
  9.    total = cardMax;
  10.    set("/:count",0);
  11.    a = new Array(total);
  12.    i = 1;
  13.    while(total >= i)
  14.    {
  15.       R = random(total);
  16.       if(a[R] != null)
  17.       {
  18.          R = random(total);
  19.          if(a[R] != null)
  20.          {
  21.             R = random(total);
  22.             if(a[R] != null)
  23.             {
  24.                R = 0;
  25.                while(total >= R)
  26.                {
  27.                   if(a[R] == null)
  28.                   {
  29.                      break;
  30.                   }
  31.                   R++;
  32.                }
  33.             }
  34.          }
  35.       }
  36.       a[R] = i;
  37.       i++;
  38.    }
  39.    x = 0;
  40.    while(total - 1 >= x)
  41.    {
  42.       x += 1;
  43.       set("/:block" add x,a[x - 1]);
  44.    }
  45. }
  46. function setBlocks()
  47. {
  48.    x = 1;
  49.    while(10 >= x)
  50.    {
  51.       count += 1;
  52.       set("_root.cB" + x + ".rValue",eval("/:block" + count));
  53.       eval("_root.cB" + x).gotoAndStop(eval("/:block" + count));
  54.       count += 1;
  55.       set("_root.pB" + x + ".rValue",eval("/:block" + count));
  56.       eval("_root.pB" + x).gotoAndStop(eval("/:block" + count));
  57.       x++;
  58.    }
  59. }
  60. function setChanceBlocks()
  61. {
  62.    x = 1;
  63.    while(cardMax - 20 >= x)
  64.    {
  65.       count += 1;
  66.       set("/:drawBlock" + x,eval("/:block" + count));
  67.       x++;
  68.    }
  69. }
  70.