home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Puzzle / DinkySmash.swf / scripts / frame_9 / DoAction.as
Encoding:
Text File  |  2005-08-04  |  65.3 KB  |  2,199 lines

  1. function Screen(numColours, level, difficulty)
  2. {
  3.    ID = 10000;
  4.    this.ballCount = 0;
  5.    this.difficulty = difficulty;
  6.    this.level = level;
  7.    this.loseRow = 2;
  8.    this.numColours = numColours;
  9.    this.ID = 200;
  10.    this.canGo = true;
  11.    this.canGo2 = true;
  12.    this.ballSize = 26;
  13.    this.halfBS = 13;
  14.    this.rowSize = this.ballSize * 0.87;
  15.    this.mc = createEmptyMovieClip("screen",0);
  16.    this.mc._y = 40 - 2 * this.rowSize;
  17.    this.mc._x = 46;
  18.    this.mc.myObject = this;
  19.    this.numRows = 16;
  20.    this.numCollumns = 14;
  21.    this.fallSpeed = 13;
  22.    this.sideX = this.ballSize / 2 * this.numcollumns;
  23.    this.amountOfColours = new Array();
  24.    this.waitBallsArray = new Array();
  25.    this.ballsArray = new Array();
  26.    this.rowsY = new Array();
  27.    this.rowsIsOffSet = new Array();
  28.    this.collumnsX = new Array();
  29.    this.rowsArray = new Array();
  30.    this.floorX = new Array();
  31.    var i = 0;
  32.    while(i <= this.numRows)
  33.    {
  34.       this.rowsArray[i] = new Array();
  35.       this.rowsY[i] = this.ballSize / 2 + (i + 2) * (this.ballSize * 0.87);
  36.       i++;
  37.    }
  38.    var i = 0;
  39.    while(i < this.numCollumns)
  40.    {
  41.       this.collumnsX[i] = this.ballSize / 2 + this.ballSize / 2 * i;
  42.       this.rowsArray[this.numRows][i] = "floor";
  43.       if(i % 2 == 0)
  44.       {
  45.          this.floorX[i] = this.collumnsX[i];
  46.       }
  47.       i++;
  48.    }
  49.    this.floorY = floorY = this.ballSize + this.ballSize * 0.87 * (this.numRows + 1);
  50.    this.mc.wdth = screenWidth = this.collumnsX[this.numCollumns - 1] + this.ballSize / 2;
  51.    this.mc.hgth = screenHeight = this.floorY - this.ballSize / 2 + this.ballSize * 0.13;
  52.    this.bg = this.mc.attachMovie("_lscreen","screen",1);
  53.    this.bg._visible = 0;
  54.    this.bg._width = this.mc.wdth;
  55.    this.bg._height = this.mc.hgth;
  56.    this.platform = this.mc.attachMovie("_lplatform","platform",2);
  57.    this.platform._y = this.floorY - 6;
  58. }
  59. function InstructionScreen(numColours, level, difficulty)
  60. {
  61.    ID = 10000;
  62.    this.ballCount = 0;
  63.    this.difficulty = difficulty;
  64.    this.level = level;
  65.    this.loseRow = 2;
  66.    this.numColours = numColours;
  67.    this.ID = 200;
  68.    this.canGo = true;
  69.    this.canGo2 = true;
  70.    this.ballSize = 26;
  71.    this.halfBS = 13;
  72.    this.rowSize = this.ballSize * 0.87;
  73.    this.mc = createEmptyMovieClip("screen",0);
  74.    this.mc._y = 40 - 2 * this.rowSize;
  75.    this.mc._x = 46;
  76.    this.mc.myObject = this;
  77.    this.numRows = 16;
  78.    this.numCollumns = 14;
  79.    this.fallSpeed = 13;
  80.    this.sideX = this.ballSize / 2 * this.numcollumns;
  81.    this.amountOfColours = new Array();
  82.    this.waitBallsArray = new Array();
  83.    this.ballsArray = new Array();
  84.    this.rowsY = new Array();
  85.    this.rowsIsOffSet = new Array();
  86.    this.collumnsX = new Array();
  87.    this.rowsArray = new Array();
  88.    this.floorX = new Array();
  89.    var i = 0;
  90.    while(i <= this.numRows)
  91.    {
  92.       this.rowsArray[i] = new Array();
  93.       this.rowsY[i] = this.ballSize / 2 + (i + 2) * (this.ballSize * 0.87);
  94.       i++;
  95.    }
  96.    var i = 0;
  97.    while(i < this.numCollumns)
  98.    {
  99.       this.collumnsX[i] = this.ballSize / 2 + this.ballSize / 2 * i;
  100.       this.rowsArray[this.numRows][i] = "floor";
  101.       if(i % 2 == 0)
  102.       {
  103.          this.floorX[i] = this.collumnsX[i];
  104.       }
  105.       i++;
  106.    }
  107.    this.floorY = floorY = this.ballSize + this.ballSize * 0.87 * (this.numRows + 1);
  108.    this.mc.wdth = screenWidth = this.collumnsX[this.numCollumns - 1] + this.ballSize / 2;
  109.    this.mc.hgth = screenHeight = this.floorY - this.ballSize / 2 + this.ballSize * 0.13;
  110.    this.bg = this.mc.attachMovie("_lscreen","screen",1);
  111.    this.bg._alpha = 0;
  112.    this.bg._width = this.mc.wdth;
  113.    this.bg._height = this.mc.hgth;
  114.    this.platform = this.mc.attachMovie("_lplatform","platform",2);
  115.    this.platform._y = this.floorY - 6;
  116. }
  117. function BomberScreen(numColours, level, difficulty)
  118. {
  119.    this.dinkysToHit = bomberDinkys[level];
  120.    this.timeLimit = bomberTime[level];
  121.    gui.dinkyNumbers.gotoAndStop(2);
  122.    this.doDinkyNum();
  123.    this.difficulty = difficulty;
  124.    this.level = level;
  125.    this.ID = 200;
  126.    this.ballSize = 26;
  127.    this.halfBS = 13;
  128.    this.rowSize = this.ballSize * 0.87;
  129.    this.canGo = true;
  130.    this.canGo2 = true;
  131.    this.mc = createEmptyMovieClip("screen",0);
  132.    this.mc._y = 40 - 2 * this.rowSize;
  133.    this.mc._x = 46;
  134.    this.mc.myObject = this;
  135.    this.fallSpeed = 13;
  136.    this.mc.wdth = screenWidth;
  137.    this.mc.hgth = screenHeight;
  138.    this.bg = this.mc.attachMovie("_lscreen","screen",1);
  139.    this.bg._alpha = 0;
  140.    this.bg._width = this.mc.wdth;
  141.    this.bg._height = this.mc.hgth;
  142.    this.platform = this.mc.attachMovie("_lplatform","platform",2);
  143.    this.platform._y = floorY - 6;
  144.    this.mdArray = new Array();
  145. }
  146. function Ball(colour, x, wait, myScreen)
  147. {
  148.    this.colour = colour;
  149.    this.ballNum = 3;
  150.    this.myScreen = myScreen;
  151.    while(this.myScreen.ballsArray[this.ballNum].kind == "ball")
  152.    {
  153.       this.ballNum = this.ballNum + 1;
  154.    }
  155.    this.myScreen.ballsArray[this.ballNum] = this;
  156.    this.mc = this.myScreen.mc.attachMovie("ball" + colour,"ball" + this.ballNum,this.ballNum);
  157.    if(x < this.myScreen.ballSize / 2)
  158.    {
  159.       x = this.myScreen.ballSize / 2;
  160.    }
  161.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  162.    {
  163.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  164.    }
  165.    if(wait)
  166.    {
  167.       this.mc.gotoAndStop("wait3");
  168.       this.wait = 3;
  169.       this.tempColour = colour;
  170.       this.tempArrayNum = 0;
  171.       while(this.myScreen.waitBallsArray[this.tempArrayNum].kind == "ball")
  172.       {
  173.          this.tempArrayNum = this.tempArrayNum + 1;
  174.       }
  175.       this.myScreen.waitBallsArray[this.tempArrayNum] = this;
  176.       this.colour = -1;
  177.    }
  178.    else
  179.    {
  180.       this.colour = colour;
  181.    }
  182.    this.x = x;
  183.    this.y = this.myScreen.rowsY[this.myScreen.loseRow];
  184.    this.kind = "ball";
  185.    this.mc._x = -100;
  186.    this.mc._y = this.y;
  187.    this.mc.myObject = this;
  188.    this.collumn = this.getCollumn();
  189.    this.row = this.myScreen.loseRow - 1;
  190. }
  191. function Bomb(power, x, myScreen)
  192. {
  193.    this.myScreen = myScreen;
  194.    this.mc = this.myScreen.mc.attachMovie("_lbomb","bomb",999);
  195.    if(x < this.myScreen.ballSize / 2)
  196.    {
  197.       x = this.myScreen.ballSize / 2;
  198.    }
  199.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  200.    {
  201.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  202.    }
  203.    this.power = power;
  204.    this.mc.gotoAndStop(power);
  205.    this.x = x;
  206.    this.y = this.myScreen.rowsY[this.myScreen.loseRow];
  207.    this.mc._x = -100;
  208.    this.mc._y = this.y;
  209.    this.mc.myObject = this;
  210.    this.collumn = this.getCollumn();
  211.    this.row = this.myScreen.loseRow - 1;
  212. }
  213. function mHead(power, x, myScreen)
  214. {
  215.    this.myScreen = myScreen;
  216.    this.mc = this.myScreen.mc.attachMovie("_lheadC","mHead",999);
  217.    if(x < this.myScreen.ballSize / 2)
  218.    {
  219.       x = this.myScreen.ballSize / 2;
  220.    }
  221.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  222.    {
  223.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  224.    }
  225.    this.power = power;
  226.    this.x = x;
  227.    this.y = this.myScreen.rowsY[this.myScreen.loseRow];
  228.    this.mc._x = -100;
  229.    this.mc._y = this.y;
  230.    this.mc.myObject = this;
  231.    this.collumn = this.getCollumn();
  232.    this.row = this.myScreen.loseRow - 1;
  233. }
  234. function timeR(power, x, myScreen)
  235. {
  236.    this.myScreen = myScreen;
  237.    this.mc = this.myScreen.mc.attachMovie("_ltimeR","timeR",999);
  238.    if(x < this.myScreen.ballSize / 2)
  239.    {
  240.       x = this.myScreen.ballSize / 2;
  241.    }
  242.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  243.    {
  244.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  245.    }
  246.    this.power = power;
  247.    this.x = x;
  248.    this.y = this.myScreen.rowsY[this.myScreen.loseRow];
  249.    this.mc._x = -100;
  250.    this.mc._y = this.y;
  251.    this.mc.myObject = this;
  252.    this.collumn = this.getCollumn();
  253.    this.row = this.myScreen.loseRow - 1;
  254. }
  255. function smartB(power, x, myScreen)
  256. {
  257.    this.myScreen = myScreen;
  258.    this.mc = this.myScreen.mc.attachMovie("_lsmartBomb","smartB",999);
  259.    if(x < this.myScreen.ballSize / 2)
  260.    {
  261.       x = this.myScreen.ballSize / 2;
  262.    }
  263.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  264.    {
  265.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  266.    }
  267.    this.power = power;
  268.    this.x = x;
  269.    this.y = this.myScreen.rowsY[this.myScreen.loseRow];
  270.    this.mc._x = -100;
  271.    this.mc._y = this.y;
  272.    this.mc.myObject = this;
  273.    this.collumn = this.getCollumn();
  274.    this.row = this.myScreen.loseRow - 1;
  275. }
  276. function Missile(x, myScreen)
  277. {
  278.    this.myScreen = myScreen;
  279.    this.mc = this.myScreen.mc.attachMovie("_lbomb","bomb" + myScreen.ID++,2000 + myScreen.ID++);
  280.    if(x < this.myScreen.ballSize / 2)
  281.    {
  282.       x = this.myScreen.ballSize / 2;
  283.    }
  284.    else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1])
  285.    {
  286.       x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1];
  287.    }
  288.    this.x = x;
  289.    this.fallSpeed = 20;
  290.    this.y = claw._y - theScreen.mc._y;
  291.    this.mc._x = -100;
  292.    this.mc._y = this.y;
  293.    this.mc.myObject = this;
  294. }
  295. function MiniDinky(myScreen)
  296. {
  297.    this.num = 3;
  298.    this.kind = "mini";
  299.    this.myScreen = myScreen;
  300.    while(this.myScreen.mdArray[this.num - 3].kind == "mini")
  301.    {
  302.       this.num = this.num + 1;
  303.    }
  304.    this.myScreen.mdArray[this.num - 3] = this;
  305.    this.mc = this.myScreen.mc.attachMovie("_lminiDinky","md" + this.num,this.num);
  306.    this.mc.gotoAndStop(Math.ceil(Math.random() * 5));
  307.    this.mc._y = floorY - 3;
  308.    this.mc.speed = 2 + Math.floor(Math.random() * 3);
  309.    this.mc.myObject = this;
  310.    if(Math.random() > 0.5)
  311.    {
  312.       this.mc._x = screenWidth + 10;
  313.       this.mc.walkLeft = true;
  314.       this.mc._xscale = -100;
  315.    }
  316.    else
  317.    {
  318.       this.mc._x = -10;
  319.       this.mc.walkLeft = false;
  320.    }
  321.    this.mc.onEnterFrame = miniMove;
  322. }
  323. function timerObject(delay, action)
  324. {
  325.    this.timer = createEmptyMovieClip("timerClip" + ID,ID++);
  326.    this.timer.delay = delay;
  327.    this.timer.action = action;
  328.    this.timer.time = getTimer();
  329.    this.timer.onEnterFrame = function()
  330.    {
  331.       if(getTimer() - this.time > this.delay)
  332.       {
  333.          this.action();
  334.          this.removeMovieClip();
  335.       }
  336.    };
  337. }
  338. function greyAction()
  339. {
  340.    if(this.num >= 0)
  341.    {
  342.       this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey");
  343.    }
  344.    if(this.num >= 0)
  345.    {
  346.       this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey");
  347.    }
  348.    if(this.num >= 0)
  349.    {
  350.       this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey");
  351.    }
  352.    else
  353.    {
  354.       delete this.onEnterFrame;
  355.       this.removeMovieClip();
  356.    }
  357. }
  358. function startScreenEnterFrame()
  359. {
  360.    var myObj = this.myObject;
  361.    if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < this._y + this.hgth)
  362.    {
  363.       Mouse.hide();
  364.    }
  365.    else
  366.    {
  367.       Mouse.show();
  368.    }
  369.    var x = this._xmouse + this._x;
  370.    if(x < this.myObject.halfBS + this._x)
  371.    {
  372.       x = this.myObject.halfBS + this._x;
  373.    }
  374.    else if(x > this.wdth - this.myObject.halfBS + this._x)
  375.    {
  376.       x = this.wdth - this.myObject.halfBS + this._x;
  377.    }
  378.    this._parent.claw._x = x;
  379.    if(Math.random() > 0.95)
  380.    {
  381.       myObj.ballsArray[Math.floor(Math.random() * myObj.ballsArray.length)].mc.head.play();
  382.    }
  383. }
  384. function screenEnterFrame()
  385. {
  386.    var myObj = this.myObject;
  387.    if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < 30 + this.hgth)
  388.    {
  389.       Mouse.hide();
  390.    }
  391.    else
  392.    {
  393.       Mouse.show();
  394.    }
  395.    var x = this._xmouse + this._x;
  396.    if(x < this.myObject.halfBS + this._x)
  397.    {
  398.       x = this.myObject.halfBS + this._x;
  399.    }
  400.    else if(x > this.wdth - this.myObject.halfBS + this._x)
  401.    {
  402.       x = this.wdth - this.myObject.halfBS + this._x;
  403.    }
  404.    this._parent.claw._x = x;
  405.    if(Math.random() > 0.95)
  406.    {
  407.       myObj.ballsArray[Math.floor(Math.random() * myObj.ballsArray.length)].mc.head.play();
  408.    }
  409.    time = getTimer() - theScreen.startTime;
  410.    if(time > myObj.timeBeforeShift)
  411.    {
  412.       if(this.count++ > myObj.shiftFrequency)
  413.       {
  414.          this.count = 0;
  415.          shiftRow = true;
  416.       }
  417.    }
  418.    if(myObj.canGo && myObj.canGo2)
  419.    {
  420.       gui.dropTimer.gotoAndStop(Math.ceil((time - dropTime) / 1000));
  421.       if(time - dropTime > 4000)
  422.       {
  423.          screenMouseDown();
  424.          gui.dropTimer.gotoAndStop(6);
  425.       }
  426.    }
  427. }
  428. function screenMouseDown()
  429. {
  430.    var myObj = theScreen;
  431.    var thisMC = theScreen.mc;
  432.    var doThis = thisMC._xmouse > 0 && thisMC._xmouse < thisMC.wdth || time - dropTime > 4;
  433.    if(theScreen.canGo && theScreen.canGo2 && doThis)
  434.    {
  435.       claw.gotoAndStop("release");
  436.       claw.colour = nextColour;
  437.       gui.nextBall.gotoAndPlay("out");
  438.       theScreen.advanceBalls();
  439.       theScreen.canGo = false;
  440.       theScreen.canGo2 = false;
  441.       theScreen.combo = 1;
  442.       if(colour < 8)
  443.       {
  444.          theScreen.amountOfColours[colour]++;
  445.          theScreen.ballsOnScreen = theScreen.ballsOnScreen + 1;
  446.          theScreen.oldBall.mc._x = theScreen.oldBall.x = claw._x - thisMC._x;
  447.          theScreen.oldBall.mc._y = theScreen.oldBall.y = theScreen.rowsY[theScreen.loseRow];
  448.          theScreen.oldBall.collumn = theScreen.oldBall.getCollumn();
  449.          theScreen.oldBall.findHighestBalls();
  450.          theScreen.oldBall.mc.onEnterFrame = firstFall;
  451.          delete theScreen.oldBall;
  452.       }
  453.       else if(colour < 10)
  454.       {
  455.          theBomb = theScreen.oldBall;
  456.          theBomb.mc._x = theBomb.x = claw._x - thisMC._x;
  457.          theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow];
  458.          theBomb.collumn = theBomb.getCollumn();
  459.          theBomb.findHighestBalls();
  460.          theBomb.mc.onEnterFrame = bombFall;
  461.          theScreen.doBonus();
  462.       }
  463.       else if(colour == 10)
  464.       {
  465.          var rg = thisMC.attachMovie("_lrailgun","railgun",10000 + theScreen.ID++);
  466.          rg.myScreen = theScreen;
  467.          rg._x = thisMC._parent.claw._x - thisMC._x;
  468.          rg._y = theScreen.rowsY[theScreen.loseRow];
  469.          rg.railgun.gotoAndPlay("go");
  470.          var railCol = int((rg._x - theScreen.ballSize / 2) / (theScreen.ballSize / 2));
  471.          var ballsRem = 0;
  472.          var y = 0;
  473.          var i = railCol - 1;
  474.          while(i <= railCol + 1)
  475.          {
  476.             var j = 0;
  477.             while(j < theScreen.numRows)
  478.             {
  479.                if(theScreen.rowsArray[j][i].kind == "ball")
  480.                {
  481.                   y = theScreen.rowsArray[j][i].mc._y;
  482.                   theScreen.explodeBall(theScreen.rowsArray[j][i]);
  483.                   ballsRem++;
  484.                }
  485.                j++;
  486.             }
  487.             i++;
  488.          }
  489.          var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10;
  490.          score += scoreAdded;
  491.          theScreen.doScore();
  492.          var as = thisMC.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++);
  493.          as.scr = scoreAdded;
  494.          theScreen.doScore();
  495.          as._x = rg._x;
  496.          as._y = y;
  497.          rgPause = function()
  498.          {
  499.             theScreen.ballsFall();
  500.          };
  501.          new TimerObject(500,rgPause);
  502.       }
  503.       else if(colour == 11)
  504.       {
  505.          theBomb = theScreen.oldBall;
  506.          theBomb.mc._x = theBomb.x = thisMC._parent.claw._x - thisMC._x;
  507.          theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow];
  508.          theBomb.collumn = theBomb.getCollumn();
  509.          theBomb.findHighestBalls();
  510.          if(theBomb.returnObject != "floor")
  511.          {
  512.             theBomb.smashColour = theBomb.returnObject.colour;
  513.             theBomb.mc.gotoAndStop(1 + theBomb.smashColour);
  514.          }
  515.          theBomb.mc.onEnterFrame = mHeadFall;
  516.          theScreen.doBonus();
  517.       }
  518.       else
  519.       {
  520.          theBomb = theScreen.oldBall;
  521.          theBomb.mc._x = theBomb.x = thisMC._parent.claw._x - thisMC._x;
  522.          theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow];
  523.          theBomb.collumn = theBomb.getCollumn();
  524.          theBomb.findHighestBalls();
  525.          theBomb.mc.onEnterFrame = mHeadFall;
  526.          theScreen.doBonus();
  527.       }
  528.    }
  529. }
  530. function doBallThing()
  531. {
  532.    fBall._x = fBall.myObject.x;
  533.    fBall._y = fBall.myObject.y;
  534.    fBall.myObject.whatHappens(fBall.wait);
  535.    delete this.onEnterFrame;
  536. }
  537. function mHeadFall()
  538. {
  539.    var hit = false;
  540.    var myObj = this.myObject;
  541.    myObj.y += myObj.fallSpeed;
  542.    this._y = myObj.y;
  543.    if(++myObj.fallCount >= myObj.fallFrames)
  544.    {
  545.       this.gotoAndPlay("destroy");
  546.       myObj.row = myObj.returnRow;
  547.       this._y = theScreen.rowsY[myObj.row];
  548.       delete this.onEnterFrame;
  549.    }
  550. }
  551. function bombFall()
  552. {
  553.    var hit = false;
  554.    var myObj = this.myObject;
  555.    myObj.y += myObj.fallSpeed;
  556.    this._y = myObj.y;
  557.    if(++myObj.fallCount >= myObj.fallFrames)
  558.    {
  559.       myObj.row = myObj.returnRow;
  560.       this._y = theScreen.rowsY[myObj.row];
  561.       myObj.explode(myObj.power);
  562.       this.gotoAndPlay("fire");
  563.       delete this.onEnterFrame;
  564.    }
  565. }
  566. function firstFall()
  567. {
  568.    var hit = false;
  569.    var myObj = this.myObject;
  570.    myObj.y += myObj.fallSpeed;
  571.    if(++myObj.fallCount >= myObj.fallFrames)
  572.    {
  573.       myObj.row = myObj.returnRow;
  574.       this._y = theScreen.rowsY[myObj.row];
  575.       delete myObj.fallCount;
  576.       delete myObj.fallFrames;
  577.       delete myObj.fallSpeed;
  578.       myObj.whatHappens(false);
  579.       this._parent._parent.doTinkSound();
  580.       delete this.onEnterFrame;
  581.    }
  582.    else
  583.    {
  584.       this._y = myObj.y;
  585.    }
  586. }
  587. function dostars(b)
  588. {
  589.    b.numStars = 3;
  590.    var i = 0;
  591.    while(i < b.numStars)
  592.    {
  593.       var st = b.star.duplicateMovieClip("star" + i,i);
  594.       st.xSpeed = Math.random() * 20 - 10;
  595.       st.ySpeed = Math.random() * 3 - 8;
  596.       st.rotate = Math.random() * 10 - 20;
  597.       st.scaleChange = 3;
  598.       st.isStar = true;
  599.       st.num = i;
  600.       60 + Math.random() * 40;
  601.       st.gotoAndStop(Math.ceil(Math.random() * 2));
  602.       st.onEnterFrame = function()
  603.       {
  604.          if(this.isStar)
  605.          {
  606.             this._xscale -= this.scaleChange;
  607.             this._yscale -= this.scaleChange;
  608.             this._x += this.xSpeed;
  609.             this._y += this.ySpeed;
  610.             this._rotation += this.rotate;
  611.             this.ySpeed += 0.5;
  612.          }
  613.       };
  614.       i++;
  615.    }
  616.    var sh = new Sound(b);
  617.    sh.attachSound("_lshatter" + Math.ceil(Math.random() * 4));
  618.    sh.start();
  619.    b.star._visible = false;
  620. }
  621. function doAvatar(move)
  622. {
  623.    if(move == "gameOver")
  624.    {
  625.       avatarFree = false;
  626.       gui.avatar.gotoAndStop("blowUp");
  627.    }
  628.    else if(avatarFree)
  629.    {
  630.       avatarFree = false;
  631.       gui.avatar.gotoAndStop(move);
  632.    }
  633. }
  634. function doTinkSound()
  635. {
  636.    var tk = new Sound();
  637.    tk.attachSound("_ltink" + Math.ceil(Math.random() * 2));
  638.    tk.start();
  639. }
  640. function nextLevel()
  641. {
  642.    removeIntervals();
  643.    theScreen.mc.removeMovieClip();
  644.    delete theScreen;
  645.    delete theBomb;
  646.    delete rg;
  647.    if(levelDescr[level] == "bomber")
  648.    {
  649.       theScreen = new BomberScreen(8,level,difficulty);
  650.    }
  651.    else
  652.    {
  653.       isPattern = levelDescr[level] == "pattern";
  654.       theScreen = new Screen(8,level,difficulty);
  655.    }
  656.    theScreen.startGame();
  657. }
  658. function initialiseGame(d, p)
  659. {
  660.    gameStarted = false;
  661.    gui.avatar.gotoAndStop(1);
  662.    gui.nextBall.gotoAndStop(16);
  663.    difficulty = d;
  664.    level = 1;
  665.    tempScore = 0;
  666.    score = 0;
  667.    bonusLev = 1;
  668.    bonusLevel = -1;
  669.    gui.dinkyNumbers.gotoAndStop(1);
  670.    scoresArray = new Array(0,0,0,0,0,0,0);
  671.    var i = 0;
  672.    while(i < 7)
  673.    {
  674.       gui["score" + i].gotoAndStop(1);
  675.       i++;
  676.    }
  677.    players = p;
  678.    nextLevel();
  679.    theScreen.doScore();
  680.    theScreen.doBonus();
  681. }
  682. function removeIntervals()
  683. {
  684.    clearInterval(checkPause);
  685.    clearInterval(bombPause);
  686.    clearInterval(pause);
  687.    clearInterval(abfpause);
  688.    clearInterval(rgPause);
  689.    clearInterval(specialPause);
  690.    clearInterval(CCpause);
  691. }
  692. function resetGame()
  693. {
  694.    level = 1;
  695.    score = 0;
  696.    bonusLev = 1;
  697.    bonusLevel = -1;
  698.    gui.menuButton._visible = false;
  699.    gui.resetButton._visible = false;
  700.    delete theBomb;
  701.    instructions.gotoAndStop(1);
  702.    instructions._visible = false;
  703.    floor = "floor";
  704.    removeIntervals();
  705.    theScreen.mc.removeMovieClip();
  706.    delete theScreen;
  707.    gui.miniDinkyTimer.gotoAndStop(1);
  708.    gui.dinkyNumbers.gotoAndStop(1);
  709.    gui.bonusSlider.gotoAndStop(1);
  710.    gui.bonus.gotoAndStop(1);
  711.    if(gui.dropTimerCover._currentFrame != 1)
  712.    {
  713.       gui.dropTimerCover.gotoAndPlay("close");
  714.    }
  715.    gui.bonusBar.gotoAndStop(1);
  716.    gui.bonusStars.gotoAndStop(1);
  717.    gui.doors.gotoAndPlay("iClose");
  718.    gui.doors.tDoor.gotoAndStop(1);
  719.    gui.doors.bDoor.gotoAndStop(1);
  720.    Mouse.show();
  721.    Key.removeListener(myListener);
  722. }
  723. function startGame()
  724. {
  725.    resetGame();
  726.    gui.resetButton._visible = true;
  727.    initialiseGame(1,1);
  728. }
  729. function bScreenEnterFrame()
  730. {
  731.    var myObj = this.myObject;
  732.    if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < 30 + this.hgth)
  733.    {
  734.       Mouse.hide();
  735.    }
  736.    else
  737.    {
  738.       Mouse.show();
  739.    }
  740.    var x = this._xmouse + this._x;
  741.    if(x < this.myObject.halfBS + this._x)
  742.    {
  743.       x = this.myObject.halfBS + this._x;
  744.    }
  745.    else if(x > this.wdth - this.myObject.halfBS + this._x)
  746.    {
  747.       x = this.wdth - this.myObject.halfBS + this._x;
  748.    }
  749.    this._parent.claw._x = x;
  750.    time = getTimer() - myObj.startTime;
  751.    if(myObj.canGo && myObj.canGo2)
  752.    {
  753.       gui.dropTimer.gotoAndStop(Math.ceil((time - dropTime) / 1000));
  754.       if(time - dropTime > 4000)
  755.       {
  756.          bScreenMouseDown();
  757.          gui.dropTimer.gotoAndStop(6);
  758.       }
  759.    }
  760.    if(this.mdCount++ > 15)
  761.    {
  762.       var md = new MiniDinky(myObj);
  763.       this.mdCount = Math.ceil(Math.random() * 10);
  764.    }
  765.    if(time < myObj.timeLimit)
  766.    {
  767.       gui.miniDinkyTimer.gotoAndStop(Math.ceil(2 + 100 / myObj.timeLimit * time));
  768.    }
  769. }
  770. function bScreenMouseDown()
  771. {
  772.    var myObj = theScreen;
  773.    var thisMC = theScreen.mc;
  774.    var doThis = thisMC._xmouse > 0 && thisMC._xmouse < thisMC.wdth || time - dropTime > 4;
  775.    if(myObj.canGo && myObj.canGo2 && doThis)
  776.    {
  777.       claw.gotoAndStop("release");
  778.       claw.colour = nextColour;
  779.       gui.nextBall.gotoAndPlay("out");
  780.       theScreen.canGo = false;
  781.       theScreen.canGo2 = false;
  782.       theScreen.combo = 1;
  783.       if(colour < 10)
  784.       {
  785.          theBomb = theScreen.oldBall;
  786.          theBomb.mc._x = theBomb.x = claw._x - thisMC._x;
  787.          theBomb.mc.onEnterFrame = missileFall;
  788.       }
  789.       var sh = new Sound(this);
  790.       sh.attachSound("_lfall");
  791.       sh.start();
  792.    }
  793. }
  794. function missileFall()
  795. {
  796.    var myObj = this.myObject;
  797.    myObj.y += myObj.fallSpeed;
  798.    this._y = myObj.y;
  799.    if(this._y >= screenHeight)
  800.    {
  801.       this._y = screenHeight;
  802.       delete this.onEnterFrame;
  803.       myObj.explode();
  804.       this.gotoAndPlay("fire");
  805.    }
  806. }
  807. function miniMove()
  808. {
  809.    if(this.walkLeft)
  810.    {
  811.       this._x -= this.speed;
  812.    }
  813.    else
  814.    {
  815.       this._x += this.speed;
  816.    }
  817.    if(Math.random() > 0.99)
  818.    {
  819.       this.walkLeft = !this.walkLeft;
  820.       this.mc._xscale *= -1;
  821.    }
  822.    if(this._x > screenWidth + 25 || this._x < -25)
  823.    {
  824.       theScreen.removeMini(this.myObject);
  825.       this.removeMovieClip();
  826.    }
  827. }
  828. function miniFly()
  829. {
  830.    this._x += this.xSpeed;
  831.    this._y += this.ySpeed;
  832.    this._rotation += this.rotate;
  833.    this.ySpeed += 0.8;
  834.    if(this._y >= screenHeight && this.ySpeed > 0)
  835.    {
  836.       if(this.ySpeed < 2)
  837.       {
  838.          this.stopped = true;
  839.       }
  840.       this.ySpeed *= -0.5;
  841.    }
  842.    if(this.stopped)
  843.    {
  844.       this._alpha -= 10;
  845.    }
  846.    if(this._x < -10 || this._x > screenWidth || this._alpha < 20)
  847.    {
  848.       theScreen.removeMini(this.myObject);
  849.       this.removeMovieClip();
  850.    }
  851. }
  852. function instrDropBall()
  853. {
  854.    var myObj = theScreen;
  855.    var thisMC = theScreen.mc;
  856.    claw.gotoAndStop("release");
  857.    claw.colour = nextColour;
  858.    gui.nextBall.gotoAndPlay("out");
  859.    theScreen.combo = 1;
  860.    if(colour < 8)
  861.    {
  862.       theScreen.oldBall.mc._x = theScreen.oldBall.x = claw._x - thisMC._x;
  863.       theScreen.oldBall.mc._y = theScreen.oldBall.y = theScreen.rowsY[theScreen.loseRow];
  864.       theScreen.oldBall.collumn = theScreen.oldBall.getCollumn();
  865.       theScreen.oldBall.findHighestBalls();
  866.       theScreen.oldBall.mc.onEnterFrame = firstFall;
  867.       delete theScreen.oldBall;
  868.    }
  869.    else
  870.    {
  871.       theBomb = theScreen.oldBall;
  872.       theBomb.mc._x = theBomb.x = claw._x - thisMC._x;
  873.       theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow];
  874.       theBomb.collumn = theBomb.getCollumn();
  875.       theBomb.findHighestBalls();
  876.       theBomb.mc.onEnterFrame = bombFall;
  877.       theScreen.doBonus();
  878.    }
  879. }
  880. function instructionMissile()
  881. {
  882.    gui.bonusSlider.bonusI.gotoAndStop(bonusLevel);
  883.    gui.bonusSlider.gotoAndPlay(2);
  884.    var ob = theScreen.oldBall;
  885.    ob.mc._x = ob.x = claw._x - theScreen.mc._x;
  886.    ob.mc._y = ob.y = theScreen.rowsY[theScreen.loseRow];
  887.    delete theScreen.ballsArray[ob.ballNum];
  888.    ob.mc.gotoAndPlay(2);
  889.    delete ob;
  890.    colour = bonusLevel + 7;
  891.    claw.colour = colour;
  892.    claw.gotoAndPlay(1);
  893.    theScreen.oldBall = new Bomb(colour - 7,-100,theScreen);
  894.    bonusLev = 1;
  895.    gui.bonus.gotoAndStop(1);
  896.    theScreen.doBonus();
  897. }
  898. function removeInstructions()
  899. {
  900.    delete theBomb;
  901.    theScreen.mc.removeMovieClip();
  902.    delete theScreen;
  903.    instructions._visible = false;
  904. }
  905. function doInstructions()
  906. {
  907.    if(doneInstructionsOnce)
  908.    {
  909.       gui.menuButton._visible = true;
  910.       instructions._visible = true;
  911.       isPattern = true;
  912.       theScreen = new InstructionScreen(8,999,1);
  913.       theScreen.populate(4,8);
  914.    }
  915.    else
  916.    {
  917.       theScreen = new InstructionScreen(8,999,1);
  918.       theScreen.populate(4,8);
  919.    }
  920. }
  921. Function.prototype.extend = function(superClass)
  922. {
  923.    this.prototype.__proto__ = superClass.prototype;
  924.    this.prototype.__constructor__ = superClass;
  925.    ASSetPropFlags(this.prototype,["__constructor__"],1);
  926. };
  927. ASSetPropFlags(Function.prototype,["extend"],1);
  928. InstructionScreen.extend(Screen);
  929. BomberScreen.extend(Screen);
  930. Bomb.extend(Ball);
  931. mHead.extend(Ball);
  932. timeR.extend(Ball);
  933. smartB.extend(Ball);
  934. Screen.prototype.advanceBalls = function()
  935. {
  936.    var wba = this.waitBallsArray;
  937.    var i = 0;
  938.    while(i < wba.length)
  939.    {
  940.       wba[i].wait--;
  941.       wba[i].mc.gotoAndStop("wait" + wba[i].wait);
  942.       if(wba[i].wait <= 0)
  943.       {
  944.          wba[i].colour = wba[i].tempColour;
  945.          wba[i].mc.gotoAndStop(1);
  946.          delete wba[i];
  947.       }
  948.       i++;
  949.    }
  950. };
  951. Screen.prototype.populate = function(rows, nColours)
  952. {
  953.    var i = 0;
  954.    while(i < 10)
  955.    {
  956.       this.amountOfColours[i] = 0;
  957.       i++;
  958.    }
  959.    this.ballsOnScreen = 0;
  960.    if(isPattern)
  961.    {
  962.       patternArray = new Array();
  963.       var i = 0;
  964.       while(i < this.numRows)
  965.       {
  966.          patternArray[i] = new Array();
  967.          var j = 0;
  968.          while(j < this.numCollumns)
  969.          {
  970.             var bit = levelMap[this.level][j + i * this.numCollumns];
  971.             if(bit != null)
  972.             {
  973.                patternArray[i][j] = int(bit);
  974.             }
  975.             else
  976.             {
  977.                patternArray[i][j] = null;
  978.             }
  979.             j++;
  980.          }
  981.          i++;
  982.       }
  983.       populator.colour = ballsPattern[this.level][this.numRows - 1][0];
  984.       this.patternPopulateAction();
  985.    }
  986.    else
  987.    {
  988.       this.populateAction(nColours,this.numRows - rows - 1);
  989.    }
  990. };
  991. Screen.prototype.populated = function()
  992. {
  993.    if(levelRandBall[this.level][this.ballCount] == undefined)
  994.    {
  995.       colour = Math.floor(Math.random() * this.numColours);
  996.       while(this.amountOfColours[colour] == 0)
  997.       {
  998.          colour = int(Math.random() * this.numColours);
  999.       }
  1000.       nextColour = Math.floor(Math.random() * this.numColours);
  1001.       while(this.amountOfColours[nextColour] == 0)
  1002.       {
  1003.          nextColour = int(Math.random() * this.numColours);
  1004.       }
  1005.    }
  1006.    else
  1007.    {
  1008.       colour = levelRandBall[this.level][this.ballCount++];
  1009.       nextColour = levelRandBall[this.level][this.ballCount++];
  1010.    }
  1011.    claw.colour = colour;
  1012.    this.oldBall = new Ball(colour,-100,false,this);
  1013.    gui.nextBall.colour = nextColour + 1;
  1014.    gui.nextBall.gotoAndPlay(1);
  1015.    this.canGo = true;
  1016.    this.startTime = getTimer();
  1017.    if(gameStarted)
  1018.    {
  1019.       gui.doors.gotoAndPlay("open");
  1020.    }
  1021.    else
  1022.    {
  1023.       gameStarted = true;
  1024.       gui.doors.gotoAndPlay(2);
  1025.    }
  1026.    gui.dropTimerCover.gotoAndPlay("open");
  1027.    this.dialogue.gotoAndPlay("out");
  1028.    claw.gotoAndPlay(1);
  1029.    theScreen.mc.onEnterFrame = screenEnterFrame;
  1030.    theScreen.mc.onMouseDown = screenMouseDown;
  1031. };
  1032. screen.prototype.patternPopulateAction = function()
  1033. {
  1034.    var i = 0;
  1035.    while(i < this.numRows)
  1036.    {
  1037.       var j = 0;
  1038.       while(j < this.numCollumns)
  1039.       {
  1040.          var colourT = patternArray[i][j];
  1041.          if(colourT == 8)
  1042.          {
  1043.             colourT = -99;
  1044.          }
  1045.          if(colourT != null && colourT != undefined)
  1046.          {
  1047.             if(colourT >= 0)
  1048.             {
  1049.                this.amountOfColours[colourT]++;
  1050.                this.ballsOnScreen = this.ballsOnScreen + 1;
  1051.             }
  1052.             var newBall = new Ball(colourT,0,false,this);
  1053.             newBall.row = i + 1;
  1054.             newBall.collumn = j;
  1055.             newBall.x = newBall.mc._x = this.collumnsX[j];
  1056.             newBall.y = newBall.mc._y = this.rowsY[i + 1];
  1057.             this.rowsArray[i + 1][j] = newBall;
  1058.          }
  1059.          j++;
  1060.       }
  1061.       i++;
  1062.    }
  1063.    this.populated();
  1064. };
  1065. Screen.prototype.populateAction = function(nColours, lastRow)
  1066. {
  1067.    var rowT = this.numRows - 1;
  1068.    var collumnT = 0;
  1069.    var colourT = level % nColours;
  1070.    while(rowT > lastRow)
  1071.    {
  1072.       if(collumnT < this.numCollumns)
  1073.       {
  1074.          if(++colourT == nColours)
  1075.          {
  1076.             colourT = 0;
  1077.          }
  1078.          this.amountOfColours[colourT]++;
  1079.          this.ballsOnScreen = this.ballsOnScreen + 1;
  1080.          var newBall = new Ball(colourT,0,false,this);
  1081.          newBall.row = rowT;
  1082.          newBall.collumn = collumnT;
  1083.          newBall.x = newBall.mc._x = this.collumnsX[collumnT];
  1084.          newBall.y = newBall.mc._y = this.rowsY[rowT];
  1085.          this.rowsArray[rowT][collumnT] = newBall;
  1086.          collumnT += 2;
  1087.       }
  1088.       else
  1089.       {
  1090.          rowT--;
  1091.          if((this.numRows - rowT) % 2 == 1)
  1092.          {
  1093.             collumnT = 0;
  1094.          }
  1095.          else
  1096.          {
  1097.             collumnT = 1;
  1098.          }
  1099.       }
  1100.    }
  1101.    this.populated();
  1102. };
  1103. Screen.prototype.addEballs = function(pattern, balls)
  1104. {
  1105.    var i = 0;
  1106.    while(i < balls.length)
  1107.    {
  1108.       i++;
  1109.    }
  1110. };
  1111. Screen.prototype.shiftRows = function()
  1112. {
  1113.    this.loseRow = this.loseRow + 1;
  1114.    this.mc._y -= this.rowSize;
  1115.    this.dialogue._y += this.rowSize;
  1116.    var sh = new Sound(this.platform);
  1117.    sh.attachSound("_lshiftRow");
  1118.    sh.start();
  1119.    doAvatar("hanghead");
  1120. };
  1121. Screen.prototype.ballsFall = function()
  1122. {
  1123.    this.combo = this.combo + 1;
  1124.    var i = 0;
  1125.    while(i < this.ballsArray.length)
  1126.    {
  1127.       this.ballsArray[i].fallen = false;
  1128.       i++;
  1129.    }
  1130.    this.row = this.numRows - 2;
  1131.    this.collumn = 0;
  1132.    this.ballsChanged = false;
  1133.    this.allBallsFall();
  1134. };
  1135. Screen.prototype.allBallsFall = function()
  1136. {
  1137.    var startRow = this.row;
  1138.    var b;
  1139.    var processed = false;
  1140.    while(b = this.rowsArray[this.row][this.collumn].kind != "ball" || b.fallen)
  1141.    {
  1142.       if(this.collumn >= this.numCollumns)
  1143.       {
  1144.          if(this.row < 0 || this.row + 1 < startRow)
  1145.          {
  1146.             if(this.ballsChanged)
  1147.             {
  1148.                var abfpause = function()
  1149.                {
  1150.                   theScreen.colourCheck();
  1151.                };
  1152.                new TimerObject(135,abfpause);
  1153.             }
  1154.             else
  1155.             {
  1156.                this.nextGo();
  1157.             }
  1158.             return undefined;
  1159.          }
  1160.          this.row--;
  1161.          this.collumn = 0;
  1162.       }
  1163.       else
  1164.       {
  1165.          this.collumn = this.collumn + 1;
  1166.       }
  1167.    }
  1168.    if(!b.fallen)
  1169.    {
  1170.       b.fallen = true;
  1171.       b.popFall();
  1172.    }
  1173. };
  1174. Screen.prototype.colourCheck = function()
  1175. {
  1176.    var i = 0;
  1177.    while(i < this.ballsArray.length)
  1178.    {
  1179.       this.ballsArray[i].checked = false;
  1180.       this.ballsArray[i].chainCounted = false;
  1181.       i++;
  1182.    }
  1183.    var i = 0;
  1184.    while(i < this.ballsArray.length)
  1185.    {
  1186.       if(!this.ballsArray[i].checked && this.ballsArray[i].colour >= 0)
  1187.       {
  1188.          this.ballsArray[i].ballColourCheck();
  1189.       }
  1190.       i++;
  1191.    }
  1192.    var thereAreChains = false;
  1193.    var i = 0;
  1194.    while(i < this.ballsArray.length)
  1195.    {
  1196.       var b = this.ballsArray[i];
  1197.       if(b.chain.length > 2)
  1198.       {
  1199.          if(!b.chainCounted)
  1200.          {
  1201.             var comBall = b;
  1202.             var scoreAdded = Math.ceil(b.chain.length * this.combo * this.level * this.difficulty) * 10;
  1203.             score += scoreAdded;
  1204.             this.doScore();
  1205.             if(this.combo > 1)
  1206.             {
  1207.                bonusLev += (this.combo - 1) * b.chain.length * 2;
  1208.                var k = 0;
  1209.                while(k < 5)
  1210.                {
  1211.                   var st = this.mc.attachMovie("_lstar","star" + this.ID,10000 + this.ID++);
  1212.                   st.ySpeed = -5 - Math.random() * 5;
  1213.                   st.xSpeed = 1 - Math.random() * 20;
  1214.                   st._x = b.mc._x;
  1215.                   st._y = b.mc._y;
  1216.                   st._xscale = st.yscale = 50 * Math.ceil(Math.random() * 2);
  1217.                   st.onEnterFrame = function()
  1218.                   {
  1219.                      if(this._x > screenWidth + 30 || this._y > screenHeight + 30)
  1220.                      {
  1221.                         theScreen.doBonus();
  1222.                         this._parent._parent.gui.bonusBar.flash.gotoAndPlay(2);
  1223.                         this._parent._parent.gui.bonusStars.flash.gotoAndPlay(2);
  1224.                         this.removeMovieClip();
  1225.                      }
  1226.                      else
  1227.                      {
  1228.                         this._x += this.xSpeed;
  1229.                         this._y += this.ySpeed;
  1230.                         this.xSpeed += (screenWidth - this._x) / 40;
  1231.                         this.ySpeed += (screenHeight - this._y) / 40;
  1232.                      }
  1233.                   };
  1234.                   k++;
  1235.                }
  1236.             }
  1237.             var as = this.mc.attachMovie("_laddScore","aScore" + this.ID,10000 + this.ID++);
  1238.             as.scr = scoreAdded;
  1239.             as._x = b.mc._x;
  1240.             as._y = b.mc._y;
  1241.          }
  1242.          var j = 0;
  1243.          while(j < b.chain.length)
  1244.          {
  1245.             b.chain[j].chainCounted = true;
  1246.             j++;
  1247.          }
  1248.          this.explodeBall(b);
  1249.          thereAreChains = true;
  1250.       }
  1251.       i++;
  1252.    }
  1253.    if(thereAreChains)
  1254.    {
  1255.       if(this.combo > 1)
  1256.       {
  1257.          var ch = new Sound(this.mc);
  1258.          ch.attachSound("_lchord" + (this.combo - 1) % 5);
  1259.          ch.start();
  1260.          doAvatar("jump");
  1261.       }
  1262.       var CCpause = function()
  1263.       {
  1264.          theScreen.ballsFall();
  1265.       };
  1266.       new TimerObject(500,CCpause);
  1267.    }
  1268.    else
  1269.    {
  1270.       this.nextGo();
  1271.    }
  1272. };
  1273. Screen.prototype.explodeBall = function(b)
  1274. {
  1275.    if(b.colour >= 0)
  1276.    {
  1277.       this.amountOfColours[b.colour]--;
  1278.       this.ballsOnScreen--;
  1279.    }
  1280.    delete this.rowsArray[b.row][b.collumn];
  1281.    delete this.ballsArray[b.ballNum];
  1282.    b.mc.gotoAndPlay(2);
  1283.    delete b;
  1284. };
  1285. Screen.prototype.nextGo = function()
  1286. {
  1287.    if(this.ballsOnScreen > 0)
  1288.    {
  1289.       colour = nextColour;
  1290.       if(colour < 8)
  1291.       {
  1292.          this.oldBall = new Ball(colour,-100,false,this);
  1293.       }
  1294.       else if(colour < 10)
  1295.       {
  1296.          this.oldBall = new Bomb(colour - 7,-100,this);
  1297.       }
  1298.       else if(colour == 11)
  1299.       {
  1300.          this.oldBall = new mHead(colour - 7,-100,this);
  1301.       }
  1302.       if(levelRandBall[this.level][this.ballCount] == undefined)
  1303.       {
  1304.          nextColour = Math.floor(Math.random() * this.numColours);
  1305.          if(this.ballsOnScreen < this.stopVar)
  1306.          {
  1307.             while(this.amountOfColours[nextColour] == 0)
  1308.             {
  1309.                nextColour = int(Math.random() * this.numColours);
  1310.             }
  1311.          }
  1312.       }
  1313.       else
  1314.       {
  1315.          nextColour = levelRandBall[level][this.ballcount++];
  1316.       }
  1317.       gui.nextBall.colour = nextColour + 1;
  1318.       if(gui.nextBall._currentFrame == 18)
  1319.       {
  1320.          gui.nextBall.gotoAndPlay(1);
  1321.       }
  1322.       else
  1323.       {
  1324.          gui.nextBall.go = true;
  1325.       }
  1326.       gui.dropTimer.gotoAndStop(1);
  1327.       if(shiftRow)
  1328.       {
  1329.          shiftRow = false;
  1330.          this.shiftRows();
  1331.       }
  1332.    }
  1333.    else
  1334.    {
  1335.       this.levelCleared();
  1336.    }
  1337. };
  1338. Screen.prototype.levelCleared = function()
  1339. {
  1340.    Mouse.show();
  1341.    Key.removeListener(myListener);
  1342.    delete theScreen.mc.onMouseDown;
  1343.    delete theScreen.mc.onEnterFrame;
  1344.    claw.gotoAndStop(1);
  1345.    gui.dropTimerCover.gotoAndPlay("lclose");
  1346.    gui.doors.gotoAndPlay("close");
  1347.    gui.doors.action = "levelCleared";
  1348.    if(players == 1)
  1349.    {
  1350.       var addScore = 0;
  1351.       var levTime = 120000 + level * 5;
  1352.       if(time < levTime)
  1353.       {
  1354.          addScore = int((levTime - time) / 1000) * this.difficulty * this.level * 10;
  1355.       }
  1356.       score += addScore;
  1357.       gui.doors.addScore = addScore;
  1358.       level++;
  1359.    }
  1360.    doAvatar("jump");
  1361. };
  1362. Screen.prototype.gameOver = function()
  1363. {
  1364.    doAvatar("gameOver");
  1365.    gui.dialogue.gotoAndPlay("go");
  1366.    Mouse.show();
  1367.    delete this.mc.onMouseDown;
  1368.    delete this.mc.onEnterFrame;
  1369.    claw.gotoAndStop("release");
  1370.    gui.nextBall.gotoAndStop(16);
  1371.    var greyer = this.mc.createEmptyMovieClip("greyerMC",19929293);
  1372.    greyer.myScreen = this;
  1373.    greyer.num = this.ballsArray.length;
  1374.    greyer.onEnterFrame = greyAction;
  1375.    tempScore = score;
  1376. };
  1377. Screen.prototype.startGame = function()
  1378. {
  1379.    shiftRow = false;
  1380.    bg.gotoAndStop(level % 10 + 1);
  1381.    claw.myScreen = this;
  1382.    this.dialogue.txt.txt = "LEVEL " + this.level;
  1383.    this.dialogue.gotoAndPlay("go");
  1384.    this.timeBeforeShift = 45000 - 1000 * (this.level / 2);
  1385.    this.shiftFrequency = 310 - 5 * this.level;
  1386.    this.stopVar = 40 - this.level;
  1387.    if(this.stopVar < 1)
  1388.    {
  1389.       this.stopVar = 1;
  1390.    }
  1391.    var startRows = 4 + Math.ceil(this.level / 5);
  1392.    this.populate(startRows,8);
  1393.    Key.addListener(myListener);
  1394. };
  1395. screen.prototype.railgunFin = function()
  1396. {
  1397.    this.ballsFall();
  1398.    this.mc.railgun.removeMovieClip();
  1399. };
  1400. screen.prototype.doScore = function()
  1401. {
  1402.    if(gameStarted)
  1403.    {
  1404.       var i = 0;
  1405.       while(i < 7)
  1406.       {
  1407.          if(score < Math.pow(10,i))
  1408.          {
  1409.             var num = 0;
  1410.          }
  1411.          else
  1412.          {
  1413.             var num = Math.floor(score % Math.pow(10,i + 1) / Math.pow(10,i));
  1414.          }
  1415.          if(scoresArray[i] != num)
  1416.          {
  1417.             scoresArray[i] = num;
  1418.             gui["score" + i].num = num;
  1419.             gui["score" + i].play();
  1420.          }
  1421.          i++;
  1422.       }
  1423.    }
  1424. };
  1425. screen.prototype.doBonus = function()
  1426. {
  1427.    if(bonusLevel != Math.Floor(bonusLev / 20))
  1428.    {
  1429.       bonusLevel = Math.Floor(bonusLev / 20);
  1430.       if(bonusLevel == 0)
  1431.       {
  1432.          gui.bonus.gotoAndStop(1);
  1433.       }
  1434.       else
  1435.       {
  1436.          gui.bonus.bonusLevel = bonusLevel;
  1437.          gui.bonus.gotoAndPlay("open");
  1438.          gui.bonus.bonusT.gotoAndStop(bonusLevel);
  1439.          gui.bonus.bonusI.gotoAndStop(bonusLevel);
  1440.       }
  1441.    }
  1442.    if(bonusLev < 121)
  1443.    {
  1444.       gui.bonusBar.gotoAndStop(bonusLev);
  1445.       gui.bonusStars.gotoAndStop(Math.Floor(bonusLev / 20) + 1);
  1446.    }
  1447.    else
  1448.    {
  1449.       bonusLevel = 6;
  1450.       gui.bonusBar.gotoAndStop(120);
  1451.       gui.bonusStars.gotoAndStop(7);
  1452.    }
  1453. };
  1454. myListener = new Object();
  1455. myListener.onKeyDown = function()
  1456. {
  1457.    k = Key.getCode();
  1458.    if(k == 32 && theScreen.canGo && theScreen.canGo2 && bonusLevel > 0)
  1459.    {
  1460.       gui.bonusSlider.bonusI.gotoAndStop(bonusLevel);
  1461.       gui.bonusSlider.gotoAndPlay(2);
  1462.       theScreen.canGo2 = false;
  1463.       var ob = theScreen.oldBall;
  1464.       ob.mc._x = ob.x = claw._x - theScreen.mc._x;
  1465.       ob.mc._y = ob.y = theScreen.rowsY[theScreen.loseRow];
  1466.       delete theScreen.ballsArray[ob.ballNum];
  1467.       ob.mc.gotoAndPlay(2);
  1468.       delete ob;
  1469.       colour = bonusLevel + 7;
  1470.       claw.colour = colour;
  1471.       claw.gotoAndPlay(1);
  1472.       if(colour < 10)
  1473.       {
  1474.          theScreen.oldBall = new Bomb(colour - 7,-100,theScreen);
  1475.       }
  1476.       else if(colour == 11)
  1477.       {
  1478.          theScreen.oldBall = new mHead(colour - 7,-100,theScreen);
  1479.       }
  1480.       else if(colour == 12)
  1481.       {
  1482.          theScreen.oldBall = new timeR(colour - 7,-100,theScreen);
  1483.       }
  1484.       else if(colour == 13)
  1485.       {
  1486.          theScreen.oldBall = new smartB(colour - 7,-100,theScreen);
  1487.       }
  1488.       dropTime = time;
  1489.       bonusLev = 1;
  1490.       gui.bonus.gotoAndStop(1);
  1491.       theScreen.doBonus();
  1492.    }
  1493. };
  1494. Ball.prototype.findHighestBalls = function()
  1495. {
  1496.    this.returnRow = this.myScreen.numRows - 1;
  1497.    var returnObject = "floor";
  1498.    var r;
  1499.    if(this.collumn > 0)
  1500.    {
  1501.       var i = this.row + 1;
  1502.       while(r = this.myScreen.rowsArray[i][this.collumn - 1].kind != "ball" && i < this.myScreen.numRows)
  1503.       {
  1504.          i++;
  1505.       }
  1506.       if(r.row - 1 < this.returnRow && r.kind == "ball")
  1507.       {
  1508.          returnObject = r;
  1509.          this.returnRow = r.row - 1;
  1510.       }
  1511.    }
  1512.    if(this.collumn < this.myScreen.numCollumns)
  1513.    {
  1514.       var i = this.row + 1;
  1515.       while(r = this.myScreen.rowsArray[i][this.collumn + 1].kind != "ball" && i < this.myScreen.numRows)
  1516.       {
  1517.          i++;
  1518.       }
  1519.       if(r.row - 1 < this.returnRow && r.kind == "ball")
  1520.       {
  1521.          returnObject = r;
  1522.          this.returnRow = r.row - 1;
  1523.       }
  1524.    }
  1525.    var i = this.row + 1;
  1526.    while(r = this.myScreen.rowsArray[i][this.collumn].kind != "ball" && i < this.myScreen.numRows)
  1527.    {
  1528.       i++;
  1529.    }
  1530.    if(r.row - 1 <= this.returnRow && r.kind == "ball")
  1531.    {
  1532.       returnObject = r;
  1533.       this.returnRow = r.row - 1;
  1534.    }
  1535.    if(returnObject != "floor")
  1536.    {
  1537.       this.destY = returnObject.y - Math.sqrt(Math.pow(this.myScreen.ballSize,2) - Math.pow(this.x - returnObject.x,2)) - this.myScreen.rowsY[this.myScreen.loseRow - 1];
  1538.       this.fallSpeed = this.destY / (returnObject.row - this.myScreen.loseRow - 1);
  1539.    }
  1540.    else
  1541.    {
  1542.       this.destY = this.myScreen.rowsY[this.myScreen.numRows] - this.myScreen.rowsY[this.myScreen.loseRow - 1];
  1543.       this.fallSpeed = this.destY / (this.myScreen.numRows - this.myScreen.loseRow - 1);
  1544.    }
  1545.    this.fallCount = 1;
  1546.    this.fallFrames = Math.floor(this.destY / this.fallSpeed);
  1547.    trace("this.destY " + this.destY + ", this.returnRow " + this.returnRow + ", this.row " + this.row + ", this.fallSpeed " + this.fallSpeed);
  1548.    if(returnObject == undefined)
  1549.    {
  1550.       score = 666;
  1551.       theScreen.doScore();
  1552.    }
  1553. };
  1554. Ball.prototype.whatHappens = function(wait)
  1555. {
  1556.    var rowBelow = this.myScreen.rowsArray[this.row + 1];
  1557.    if(rowBelow[this.collumn] == "floor")
  1558.    {
  1559.       if(this.myScreen.floorX[this.collumn] == undefined)
  1560.       {
  1561.          var randomThang = Math.random();
  1562.          if(this.x < this.myScreen.collumnsX[this.collumn] || this.collumn == this.myScreen.numCollumns - 1)
  1563.          {
  1564.             randomThang = 0;
  1565.          }
  1566.          if(this.x > this.myScreen.collumnsX[this.collumn])
  1567.          {
  1568.             randomThang = 1;
  1569.          }
  1570.          if(randomThang > 0.5)
  1571.          {
  1572.             this.collumn = this.collumn + 1;
  1573.          }
  1574.          else
  1575.          {
  1576.             this.collumn--;
  1577.          }
  1578.       }
  1579.       this.x = this.mc._x = this.myScreen.collumnsX[this.collumn];
  1580.       this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1581.       this.myScreen.rowsArray[this.row][this.collumn] = this;
  1582.       if(this.row < this.myScreen.loseRow)
  1583.       {
  1584.          this.myScreen.gameOver();
  1585.       }
  1586.       else if(!wait)
  1587.       {
  1588.          var checkPause = function()
  1589.          {
  1590.             theScreen.colourCheck();
  1591.          };
  1592.          new TimerObject(200,checkPause);
  1593.       }
  1594.       else
  1595.       {
  1596.          this.myScreen.allBallsFall();
  1597.       }
  1598.    }
  1599.    else if(rowBelow[this.collumn].kind == "ball")
  1600.    {
  1601.       this.myScreen.ballsChanged = true;
  1602.       var rand = Math.random();
  1603.       if(this.x > this.myScreen.collumnsX[this.collumn])
  1604.       {
  1605.          rand = 0;
  1606.       }
  1607.       else if(this.x < this.myScreen.collumnsX[this.collumn])
  1608.       {
  1609.          rand = 1;
  1610.       }
  1611.       else if(rowBelow[this.collumn - 2].kind != "ball" || this.myScreen.rowsArray[this.row - 1][this.collumn + 2].kind == "ball")
  1612.       {
  1613.          rand = 1;
  1614.       }
  1615.       else if(rowBelow[this.collumn + 2].kind != "ball" || this.myScreen.rowsArray[this.row - 1][this.collumn - 2].kind == "ball")
  1616.       {
  1617.          rand = 0;
  1618.       }
  1619.       if(this.collumn == 0)
  1620.       {
  1621.          rand = 0;
  1622.       }
  1623.       else if(this.collumn == this.myScreen.numCollumns - 1)
  1624.       {
  1625.          rand = 1;
  1626.       }
  1627.       if(rand < 0.5)
  1628.       {
  1629.          this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1630.          this.x = this.mc._x = this.myScreen.collumnsX[this.collumn++];
  1631.          this.whatHappens(wait);
  1632.       }
  1633.       else
  1634.       {
  1635.          this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1636.          this.x = this.mc._x = this.myScreen.collumnsX[this.collumn--];
  1637.          this.whatHappens(wait);
  1638.       }
  1639.       doTinkSound();
  1640.    }
  1641.    else if(rowBelow[this.collumn - 1].kind == "ball" && rowBelow[this.collumn + 1].kind == "ball")
  1642.    {
  1643.       this.x = this.mc._x = this.myScreen.collumnsX[this.collumn];
  1644.       this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1645.       this.myScreen.rowsArray[this.row][this.collumn] = this;
  1646.       if(this.row < this.myScreen.loseRow)
  1647.       {
  1648.          this.myScreen.gameOver();
  1649.       }
  1650.       else if(!wait)
  1651.       {
  1652.          var checkPause = function()
  1653.          {
  1654.             theScreen.colourCheck();
  1655.          };
  1656.          new TimerObject(200,checkPause);
  1657.       }
  1658.       else
  1659.       {
  1660.          this.myScreen.allBallsFall();
  1661.       }
  1662.    }
  1663.    else if(rowBelow[this.collumn - 1].kind == "ball")
  1664.    {
  1665.       if(this.collumn >= this.myScreen.numCollumns - 1)
  1666.       {
  1667.          this.x = this.mc._x = this.myScreen.collumnsX[this.collumn];
  1668.          this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1669.          this.myScreen.rowsArray[this.row][this.collumn] = this;
  1670.          if(this.row < this.myScreen.loseRow)
  1671.          {
  1672.             this.myScreen.gameOver();
  1673.          }
  1674.          else if(!wait)
  1675.          {
  1676.             var checkPause = function()
  1677.             {
  1678.                theScreen.colourCheck();
  1679.             };
  1680.             new TimerObject(200,checkPause);
  1681.          }
  1682.          else
  1683.          {
  1684.             this.myScreen.allBallsFall();
  1685.          }
  1686.       }
  1687.       else
  1688.       {
  1689.          this.myScreen.ballsChanged = true;
  1690.          this.x = Number(this.myScreen.collumnsX[++this.collumn]);
  1691.          this.y = Number(this.myScreen.rowsY[++this.row]);
  1692.          this.mc.wait = wait;
  1693.          fBall = this.mc;
  1694.          ballPause = setInterval(function()
  1695.          {
  1696.             clearInterval(ballPause);
  1697.             fBall._x = fBall.myObject.x;
  1698.             fBall._y = fBall.myObject.y;
  1699.             fBall.myObject.whatHappens(fBall.wait);
  1700.          }
  1701.          ,30);
  1702.          doTinkSound();
  1703.       }
  1704.    }
  1705.    else if(rowBelow[this.collumn + 1].kind == "ball")
  1706.    {
  1707.       if(this.collumn == 0)
  1708.       {
  1709.          this.x = this.mc._x = this.myScreen.collumnsX[this.collumn];
  1710.          this.y = this.mc._y = this.myScreen.rowsY[this.row];
  1711.          this.myScreen.rowsArray[this.row][this.collumn] = this;
  1712.          if(this.row < this.myScreen.loseRow)
  1713.          {
  1714.             this.myScreen.gameOver();
  1715.          }
  1716.          else if(!wait)
  1717.          {
  1718.             var checkPause = function()
  1719.             {
  1720.                theScreen.colourCheck();
  1721.             };
  1722.             new TimerObject(200,checkPause);
  1723.          }
  1724.          else
  1725.          {
  1726.             this.myScreen.allBallsFall();
  1727.          }
  1728.       }
  1729.       else
  1730.       {
  1731.          this.myScreen.ballsChanged = true;
  1732.          this.x = this.myScreen.collumnsX[--this.collumn];
  1733.          this.y = this.myScreen.rowsY[++this.row];
  1734.          this.mc.wait = wait;
  1735.          fBall = this.mc;
  1736.          ballPause = setInterval(function()
  1737.          {
  1738.             clearInterval(ballPause);
  1739.             fBall._x = fBall.myObject.x;
  1740.             fBall._y = fBall.myObject.y;
  1741.             fBall.myObject.whatHappens(fBall.wait);
  1742.          }
  1743.          ,30);
  1744.          doTinkSound();
  1745.       }
  1746.    }
  1747.    else
  1748.    {
  1749.       this.findHighestBalls();
  1750.       delete this.myScreen.rowsArray[this.row][this.collumn];
  1751.       this.row = this.returnRow;
  1752.       this.mc._y = this.myScreen.rowsY[this.row];
  1753.       this.whatHappens(wait);
  1754.    }
  1755. };
  1756. Ball.prototype.popFall = function()
  1757. {
  1758.    this.findHighestBalls();
  1759.    if(this.returnRow != this.row)
  1760.    {
  1761.       this.myScreen.ballsChanged = true;
  1762.       doTinkSound();
  1763.    }
  1764.    delete this.myScreen.rowsArray[this.row][this.collumn];
  1765.    this.row = this.returnRow;
  1766.    this.mc._y = this.myScreen.rowsY[this.row];
  1767.    delete this.returnRow;
  1768.    this.whatHappens(true);
  1769. };
  1770. Ball.prototype.ballColourCheck = function()
  1771. {
  1772.    if(!this.checked)
  1773.    {
  1774.       this.chain = new Array();
  1775.       this.chain.push(this);
  1776.       this.checked = true;
  1777.    }
  1778.    var b;
  1779.    if(b = this.myScreen.rowsArray[this.row][this.collumn - 2].colour == this.colour)
  1780.    {
  1781.       this.addBall(b);
  1782.    }
  1783.    if(b = this.myScreen.rowsArray[this.row][this.collumn + 2].colour == this.colour)
  1784.    {
  1785.       this.addBall(b);
  1786.    }
  1787.    if(b = this.myScreen.rowsArray[this.row - 1][this.collumn - 1].colour == this.colour)
  1788.    {
  1789.       this.addBall(b);
  1790.    }
  1791.    if(b = this.myScreen.rowsArray[this.row - 1][this.collumn + 1].colour == this.colour)
  1792.    {
  1793.       this.addBall(b);
  1794.    }
  1795.    if(b = this.myScreen.rowsArray[this.row + 1][this.collumn - 1].colour == this.colour)
  1796.    {
  1797.       this.addBall(b);
  1798.    }
  1799.    if(b = this.myScreen.rowsArray[this.row + 1][this.collumn + 1].colour == this.colour)
  1800.    {
  1801.       this.addBall(b);
  1802.    }
  1803. };
  1804. Ball.prototype.addBall = function(b)
  1805. {
  1806.    if(!b.checked)
  1807.    {
  1808.       this.chain.push(b);
  1809.       b.checked = true;
  1810.       b.chain = this.chain;
  1811.       b.ballColourCheck();
  1812.    }
  1813. };
  1814. Ball.prototype.toString = function()
  1815. {
  1816.    return this.colour + ", colour";
  1817. };
  1818. Ball.prototype.getRow = function()
  1819. {
  1820.    return Math.floor((this.y - this.myScreen.ballSize / 2) / (this.myScreen.ballSize * 0.87));
  1821. };
  1822. Ball.prototype.getCollumn = function()
  1823. {
  1824.    return int((this.x - this.myScreen.ballSize / 2) / (this.myScreen.ballSize / 2));
  1825. };
  1826. Bomb.prototype.explode = function(power)
  1827. {
  1828.    var ballsRem;
  1829.    var i = this.row - power;
  1830.    while(i <= this.row + power)
  1831.    {
  1832.       var j = this.collumn - (power + 1);
  1833.       while(j <= this.collumn + (power + 1))
  1834.       {
  1835.          if(this.myScreen.rowsArray[i][j].kind == "ball")
  1836.          {
  1837.             this.myScreen.explodeBall(this.myScreen.rowsArray[i][j]);
  1838.             ballsRem++;
  1839.          }
  1840.          j++;
  1841.       }
  1842.       i++;
  1843.    }
  1844.    var scoreAdded = ballsRem * this.myScreen.level * this.myScreen.difficulty * 10;
  1845.    score += scoreAdded;
  1846.    this.myScreen.doScore();
  1847.    var as = this.myScreen.mc.attachMovie("_laddScore","aScore" + this.myScreen.ID,10000 + this.myScreen.ID++);
  1848.    as.scr = scoreAdded;
  1849.    as._x = this.x;
  1850.    as._y = this.y;
  1851.    var bombPause = function()
  1852.    {
  1853.       theScreen.ballsFall();
  1854.       delete theBomb;
  1855.    };
  1856.    new TimerObject(500,bombPause);
  1857.    doAvatar("missile");
  1858. };
  1859. mHead.prototype.explode = function()
  1860. {
  1861.    var tempCol = new Array();
  1862.    var ballsRem = 0;
  1863.    var i = 0;
  1864.    while(i < theScreen.amountOfColours.length)
  1865.    {
  1866.       if(theScreen.amountOfColours[i] < 10)
  1867.       {
  1868.          var an = "00" + theScreen.amountOfColours[i];
  1869.       }
  1870.       else if(theScreen.amountOfColours[i] < 100)
  1871.       {
  1872.          var an = "0" + theScreen.amountOfColours[i];
  1873.       }
  1874.       else
  1875.       {
  1876.          var an = "" + theScreen.amountOfColours[i];
  1877.       }
  1878.       tempCol[i] = {colour:i,number:an};
  1879.       i++;
  1880.    }
  1881.    tempCol.sortOn("number");
  1882.    var i = 0;
  1883.    while(i < theScreen.ballsArray.length)
  1884.    {
  1885.       if(theScreen.ballsArray[i].colour == tempCol[theScreen.amountOfColours.length - 1].colour || theScreen.ballsArray[i].colour == this.smashColour)
  1886.       {
  1887.          theScreen.explodeBall(theScreen.ballsArray[i]);
  1888.          ballsRem++;
  1889.       }
  1890.       i++;
  1891.    }
  1892.    var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10;
  1893.    score += scoreAdded;
  1894.    var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++);
  1895.    as.scr = scoreAdded;
  1896.    theScreen.doScore();
  1897.    as._x = screenWidth / 2;
  1898.    as._y = screenHeight * 0.75;
  1899.    var bombPause = function()
  1900.    {
  1901.       theScreen.ballsFall();
  1902.       delete theBomb;
  1903.    };
  1904.    new TimerObject(500,bombPause);
  1905. };
  1906. timeR.prototype.explode = function()
  1907. {
  1908.    timeRPause();
  1909. };
  1910. timeRPause = function()
  1911. {
  1912.    if(theScreen.loseRow > 2)
  1913.    {
  1914.       theScreen.loseRow--;
  1915.       theScreen.mc._y += theScreen.rowSize;
  1916.       theScreen.dialogue._y -= theScreen.rowSize;
  1917.       new TimerObject(500,timeRPause);
  1918.    }
  1919.    else
  1920.    {
  1921.       delete timeRCount;
  1922.       theScreen.startTime = getTimer();
  1923.       time = dropTime = 0;
  1924.       delete theBomb;
  1925.       theScreen.nextGo();
  1926.    }
  1927. };
  1928. smartB.prototype.explode = function()
  1929. {
  1930.    var ballsRem = 0;
  1931.    var i = 0;
  1932.    while(i < theScreen.ballsArray.length)
  1933.    {
  1934.       theScreen.explodeBall(theScreen.ballsArray[i]);
  1935.       ballsRem++;
  1936.       i++;
  1937.    }
  1938.    var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10;
  1939.    score += scoreAdded;
  1940.    var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++);
  1941.    as.scr = scoreAdded;
  1942.    theScreen.doScore();
  1943.    as._x = screenWidth / 2;
  1944.    as._y = screenHeight * 0.75;
  1945.    var smartBPause = function()
  1946.    {
  1947.       delete theBomb;
  1948.       theScreen.nextGo();
  1949.    };
  1950.    new TimerObject(2000,smartBPause);
  1951. };
  1952. gui.swapDepths(1002);
  1953. claw = attachMovie("_lclaw","theClaw",1000);
  1954. claw._y = 100;
  1955. claw.gotoAndStop("release");
  1956. railgun.swapDepths(1001);
  1957. gui.menuButton._visible = false;
  1958. gui.resetButton._visible = false;
  1959. levelDescr = new Array();
  1960. levelDescr[3] = "pattern";
  1961. levelDescr[4] = "bomber";
  1962. levelDescr[10] = "pattern";
  1963. levelDescr[8] = "pattern";
  1964. levelDescr[13] = "pattern";
  1965. levelDescr[14] = "bomber";
  1966. levelDescr[999] = "pattern";
  1967. bomberDinkys = new Array();
  1968. bomberTime = new Array();
  1969. bomberDinkys[4] = 20;
  1970. bomberDinkys[14] = 30;
  1971. bomberDinkys[20] = 40;
  1972. bomberTime[4] = 30000;
  1973. bomberTime[14] = 40000;
  1974. bomberTime[20] = 50000;
  1975. levelRandBall = new Array();
  1976. levelRandBall[10] = new Array(0,4,0,4,0,4);
  1977. levelRandBall[999] = new Array(0,1,4,5,4,5);
  1978. levelMap = new Array();
  1979. levelMap[3] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8,null,8,null,null,null,null,null,null,null,8,null,8,null,null,0,null,0,null,null,null,null,null,0,null,0,null,7,5,null,5,null,6,null,7,null,7,null,5,null,5,null,null,3,null,3,null,6,null,1,null,0,null,2,null,2,0,null,5,null,5,null,1,null,6,null,4,null,4,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor);
  1980. levelMap[10] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,null,null,null,null,null,null,null,null,null,0,null,4,null,5,null,3,null,2,null,4,null,5,null,null,0,null,4,null,7,null,3,null,6,null,0,null,5,4,null,5,null,5,null,7,null,2,null,2,null,0,null,null,7,null,7,null,3,null,0,null,0,null,5,null,5,1,null,1,null,3,null,6,null,6,null,4,null,4,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor);
  1981. levelMap[8] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,7,null,0,null,2,null,4,null,0,null,0,null,6,3,null,0,null,7,null,7,null,2,null,1,null,1,null,null,3,null,-99,null,-99,null,-99,null,-99,null,-99,null,-99,6,null,6,null,5,null,5,null,4,null,4,null,2,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor);
  1982. levelMap[13] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,2,null,6,null,4,null,-99,null,4,null,5,null,0,null,null,5,null,1,null,-99,null,-99,null,3,null,2,null,7,6,null,3,null,-99,null,-99,null,-99,null,6,null,4,null,null,0,null,-99,null,-99,null,-99,null,-99,null,5,null,1,0,null,-99,null,-99,null,-99,null,-99,null,-99,null,5,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor);
  1983. levelMap[999] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,null,4,null,5,null,1,null,1,null,0,null,0,7,null,3,null,4,null,5,null,2,null,7,null,6,null,null,3,null,5,null,6,null,6,null,5,null,6,null,5,7,null,7,null,3,null,4,null,4,null,2,null,2,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor);
  1984. BomberScreen.prototype.startGame = function()
  1985. {
  1986.    bg.gotoAndStop(level % 10 + 1);
  1987.    colour = 8;
  1988.    claw.myScreen = this;
  1989.    claw.colour = colour;
  1990.    this.oldBall = new Missile(-100,this);
  1991.    nextColour = 8;
  1992.    gui.nextBall.colour = nextColour + 1;
  1993.    gui.nextBall.gotoAndPlay(1);
  1994.    this.canGo = true;
  1995.    this.startTime = getTimer();
  1996.    gui.doors.gotoAndPlay(2);
  1997.    gui.dropTimerCover.gotoAndPlay("open");
  1998.    claw.gotoAndPlay(1);
  1999.    gui.miniDinkyTimer.gotoAndStop(2);
  2000.    gui.hd.gotoAndPlay(2);
  2001.    gui.hd.hd.timeLimit.gotoAndStop("f" + this.timeLimit / 1000);
  2002.    gui.hd.hd.numDinkys.gotoAndStop("f" + this.dinkysToHit);
  2003.    theScreen.mc.onEnterFrame = bScreenEnterFrame;
  2004.    theScreen.mc.onMouseDown = bScreenMouseDown;
  2005. };
  2006. BomberScreen.prototype.removeMini = function(mini)
  2007. {
  2008.    delete this.mdArray[mini.num - 3];
  2009. };
  2010. BomberScreen.prototype.nextGo = function()
  2011. {
  2012.    if(time >= this.timeLimit)
  2013.    {
  2014.       delete this.mc.onEnterFrame;
  2015.       gui.miniDinkyTimer.gotoAndPlay("timeUp");
  2016.       var TUpause = function()
  2017.       {
  2018.          gui.dinkyNumbers.gotoAndStop(1);
  2019.          theScreen.levelCleared();
  2020.       };
  2021.       new TimerObject(2500,TUpause);
  2022.    }
  2023.    else if(this.dinkysToHit > 0)
  2024.    {
  2025.       colour = 8;
  2026.       this.oldBall = new Missile(-100,this);
  2027.       nextColour = 8;
  2028.       gui.nextBall.colour = nextColour + 1;
  2029.       if(gui.nextBall._currentFrame == 18)
  2030.       {
  2031.          gui.nextBall.gotoAndPlay(1);
  2032.       }
  2033.       else
  2034.       {
  2035.          gui.nextBall.go = true;
  2036.       }
  2037.       gui.dropTimer.gotoAndStop(1);
  2038.    }
  2039.    else
  2040.    {
  2041.       delete this.mc.onEnterFrame;
  2042.       gui.miniDinkyTimer.gotoAndPlay("wellDone");
  2043.       var WDpause = function()
  2044.       {
  2045.          gui.miniDinkyTimer.gotoAndStop(1);
  2046.          gui.dinkyNumbers.gotoAndStop(1);
  2047.          theScreen.levelCleared();
  2048.       };
  2049.       new TimerObject(2500,WDpause);
  2050.    }
  2051. };
  2052. BomberScreen.prototype.doDinkyNum = function()
  2053. {
  2054.    if(this.dinkysToHit < 0)
  2055.    {
  2056.       this.dinkysToHit = 0;
  2057.    }
  2058.    gui.dinkyNumbers.num0.gotoAndStop(this.dinkysToHit % 10 + 1);
  2059.    gui.dinkyNumbers.num1.gotoAndStop(Math.floor(this.dinkysToHit / 10) + 1);
  2060. };
  2061. BomberScreen.prototype.levelCleared = function()
  2062. {
  2063.    Mouse.show();
  2064.    Key.removeListener(myListener);
  2065.    delete theScreen.mc.onMouseDown;
  2066.    delete theScreen.mc.onEnterFrame;
  2067.    claw.gotoAndStop(1);
  2068.    gui.dropTimerCover.gotoAndPlay("lclose");
  2069.    gui.doors.gotoAndPlay("close");
  2070.    gui.doors.action = "levelCleared";
  2071.    if(players == 1)
  2072.    {
  2073.       var addScore = 0;
  2074.       var levTime = this.timeLimit;
  2075.       if(time < levTime)
  2076.       {
  2077.          addScore = int((levTime - time) / 1000) * this.difficulty * this.level;
  2078.          doAvatar("jump");
  2079.       }
  2080.       else
  2081.       {
  2082.          doAvatar("hangHead");
  2083.       }
  2084.       score += addScore;
  2085.       gui.doors.addScore = addScore;
  2086.       level++;
  2087.    }
  2088. };
  2089. Missile.prototype.explode = function()
  2090. {
  2091.    var ma = theScreen.mdArray;
  2092.    var dinkysHit = 0;
  2093.    var i = 0;
  2094.    while(i < ma.length)
  2095.    {
  2096.       if(Math.abs(this.x - ma[i].mc._x) < 30)
  2097.       {
  2098.          if(ma[i].mc.onEnterFrame == miniMove)
  2099.          {
  2100.             var d = ma[i].mc._x - this.x;
  2101.             if(d < 3 && d > -3)
  2102.             {
  2103.                dinkysHit++;
  2104.             }
  2105.             theScreen.dinkysToHit--;
  2106.             dinkysHit++;
  2107.             delete ma[i].mc.onEnterFrame;
  2108.             ma[i].mc.xSpeed = Math.random() * 3 * d / 5;
  2109.             ma[i].mc.ySpeed = -7 - Math.random() * 14;
  2110.             ma[i].mc.rotate = 8 - Math.random() * 16;
  2111.             ma[i].mc.stopped = false;
  2112.             ma[i].mc.onEnterFrame = miniFly;
  2113.             var sh = new Sound(ma[i].mc);
  2114.             sh.attachSound("_lscream" + Math.ceil(Math.random() * 3));
  2115.             sh.start();
  2116.          }
  2117.       }
  2118.       i++;
  2119.    }
  2120.    if(dinkysHit > 0)
  2121.    {
  2122.       var scoreAdded = Math.ceil(theScreen.level * theScreen.difficulty) * 10 * dinkysHit;
  2123.       score += scoreAdded;
  2124.       theScreen.doScore();
  2125.       var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++);
  2126.       as.scr = scoreAdded;
  2127.       as._x = this.mc._x;
  2128.       as._y = this.mc._y;
  2129.    }
  2130.    theScreen.doDinkyNum();
  2131.    theScreen.nextGo();
  2132. };
  2133. doneInstructionsOnce = false;
  2134. InstructionScreen.prototype.populated = function()
  2135. {
  2136.    if(doneInstructionsOnce)
  2137.    {
  2138.       colour = levelRandBall[this.level][this.ballCount++];
  2139.       nextColour = levelRandBall[this.level][this.ballCount++];
  2140.       claw.colour = colour;
  2141.       this.oldBall = new Ball(colour,-100,false,this);
  2142.       gui.nextBall.colour = nextColour + 1;
  2143.       gui.nextBall.gotoAndPlay(1);
  2144.       gui.doors.gotoAndPlay("open");
  2145.       gui.dropTimerCover.gotoAndPlay("open");
  2146.       claw.gotoAndPlay(1);
  2147.       claw._x = 60;
  2148.       gui.doors.gotoAndPlay("open");
  2149.       instructions.gotoAndPlay(2);
  2150.       level = 1;
  2151.       this.level = 1;
  2152.    }
  2153.    else
  2154.    {
  2155.       colour = levelRandBall[this.level][this.ballCount++];
  2156.       nextColour = levelRandBall[this.level][this.ballCount++];
  2157.       claw.colour = colour;
  2158.       this.oldBall = new Ball(colour,-100,false,this);
  2159.       claw.gotoAndPlay(1);
  2160.       claw._x = 60;
  2161.       instrDropBall();
  2162.       doneInstructionsOnce = true;
  2163.       removeInstructions();
  2164.       doInstructions();
  2165.    }
  2166. };
  2167. InstructionScreen.prototype.nextGo = function()
  2168. {
  2169.    colour = nextColour;
  2170.    if(colour < 8)
  2171.    {
  2172.       this.oldBall = new Ball(colour,-100,false,this);
  2173.    }
  2174.    else if(colour < 10)
  2175.    {
  2176.       this.oldBall = new Bomb(colour - 7,-100,this);
  2177.    }
  2178.    nextColour = levelRandBall[999][this.ballcount++];
  2179.    gui.nextBall.colour = nextColour + 1;
  2180.    if(gui.nextBall._currentFrame == 18)
  2181.    {
  2182.       gui.nextBall.gotoAndPlay(1);
  2183.    }
  2184.    else
  2185.    {
  2186.       gui.nextBall.go = true;
  2187.    }
  2188.    gui.dropTimer.gotoAndStop(1);
  2189. };
  2190. var i = 0;
  2191. while(i < 7)
  2192. {
  2193.    gui["score" + i].num = 0;
  2194.    gui["score" + i].stop();
  2195.    i++;
  2196. }
  2197. _highquality = false;
  2198. stop();
  2199.