home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / MiniclipsTetris.swf / scripts / DefineSprite_278 / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2005-08-04  |  2.0 KB  |  79 lines

  1. function createBoxes()
  2. {
  3.    y = 1;
  4.    while(rows >= y)
  5.    {
  6.       x = 1;
  7.       while(cols >= x)
  8.       {
  9.          duplicateMovieClip("Box","Box" + x + "_" + y,16384 + eval("/:zIndex"));
  10.          setProperty("Box" + x + "_" + y, _X, Box._x + (x - 1) * (Box._width + 2));
  11.          setProperty("Box" + x + "_" + y, _Y, Box._y + (y - 1) * (Box._height + 2));
  12.          ┬º/:zIndex┬º++;
  13.          x++;
  14.       }
  15.       y++;
  16.    }
  17. }
  18. function startGame()
  19. {
  20.    stopAllSounds();
  21.    Title._visible = 0;
  22.    Text3D.write("GET READY!",65,135);
  23.    Sounds.gotoAndPlay("Start");
  24.    Music.gotoAndPlay(5);
  25.    GamePiece.start(startX,startY);
  26.    BG.gotoAndStop(1);
  27.    gameRunning = true;
  28.    removedLines = 0;
  29.    level = 1;
  30.    score = 0;
  31.    speed = userSpeed;
  32.    c = 0;
  33.    while(c < linesAtStart)
  34.    {
  35.       x = 1;
  36.       while(cols >= x)
  37.       {
  38.          if(int(Math.random() * 2) + 1 == 2)
  39.          {
  40.             eval("Box" + x + "_" + (rows - c)).gotoAndStop(2);
  41.             eval("Box" + x + "_" + (rows - c)).Brick.gotoAndStop(int(Math.random() * 9) + 1);
  42.             eval("Box" + x + "_" + (rows - c)).filled = true;
  43.          }
  44.          x++;
  45.       }
  46.       c++;
  47.    }
  48. }
  49. function showTitle()
  50. {
  51.    Title._visible = 1;
  52.    Options._visible = 0;
  53.    Options.gotoAndStop(1);
  54.    Title.gotoAndPlay(1);
  55.    Music.gotoAndPlay("Title");
  56. }
  57. function highScoreSort(scoresArray, playersArray)
  58. {
  59.    i = eval("_root." + scoresArray).length - 2;
  60.    while(i >= 0)
  61.    {
  62.       j = 0;
  63.       while(i >= j)
  64.       {
  65.          if(eval("_root." + scoresArray)[j] < eval("_root." + scoresArray)[j + 1])
  66.          {
  67.             temp1 = eval("_root." + scoresArray)[j];
  68.             temp2 = eval("_root." + playersArray)[j];
  69.             eval("_root." + scoresArray)[j] = eval("_root." + scoresArray)[j + 1];
  70.             eval("_root." + playersArray)[j] = eval("_root." + playersArray)[j + 1];
  71.             eval("_root." + scoresArray)[j + 1] = temp1;
  72.             eval("_root." + playersArray)[j + 1] = temp2;
  73.          }
  74.          j++;
  75.       }
  76.       i--;
  77.    }
  78. }
  79.