home *** CD-ROM | disk | FTP | other *** search
- function getNumberSurrounding(checkmyx, checkmyy)
- {
- var surTempCount = 0;
- if(1 < checkmyx)
- {
- surTempCount += eval("/apple" + (checkmyx - 1) + checkmyy + ":isbad");
- }
- if(checkmyx < _root.thescript.numx)
- {
- surTempCount += eval("/apple" + (checkmyx + 1) + checkmyy + ":isbad");
- }
- if(1 < checkmyy)
- {
- surTempCount += eval("/apple" + checkmyx + (checkmyy - 1) + ":isbad");
- }
- if(checkmyy < _root.thescript.numy)
- {
- surTempCount += eval("/apple" + checkmyx + (checkmyy + 1) + ":isbad");
- }
- if(1 < checkmyx && 1 < checkmyy)
- {
- surTempCount += eval("/apple" + (checkmyx - 1) + (checkmyy - 1) + ":isbad");
- }
- if(1 < checkmyx && checkmyy < _root.thescript.numy)
- {
- surTempCount += eval("/apple" + (checkmyx - 1) + (checkmyy + 1) + ":isbad");
- }
- if(checkmyx < eval("/thescript:numx") and 1 < checkmyy)
- {
- surTempCount += eval("/apple" + (checkmyx + 1) + (checkmyy - 1) + ":isbad");
- }
- if(checkmyx < eval("/thescript:numx") and checkmyy < eval("/thescript:numy"))
- {
- surTempCount += eval("/apple" + (checkmyx + 1) + (checkmyy + 1) + ":isbad");
- }
- return surTempCount;
- }
- function clearSurounding(PlaceX, PlaceY)
- {
- if(1 < PlaceX)
- {
- CheckSurround(PlaceX - 1,PlaceY);
- }
- if(PlaceX < eval("/thescript:numx"))
- {
- CheckSurround(PlaceX + 1,PlaceY);
- }
- if(1 < PlaceY)
- {
- CheckSurround(PlaceX,PlaceY - 1);
- }
- if(PlaceY < eval("/thescript:numy"))
- {
- CheckSurround(PlaceX,PlaceY + 1);
- }
- if(1 < PlaceX and 1 < PlaceY)
- {
- CheckSurround(PlaceX - 1,PlaceY - 1);
- }
- if(1 < PlaceX and PlaceY < eval("/thescript:numy"))
- {
- CheckSurround(PlaceX - 1,PlaceY + 1);
- }
- if(PlaceX < eval("/thescript:numx") and 1 < PlaceY)
- {
- CheckSurround(PlaceX + 1,PlaceY - 1);
- }
- if(PlaceX < eval("/thescript:numx") and PlaceY < eval("/thescript:numy"))
- {
- CheckSurround(PlaceX + 1,PlaceY + 1);
- }
- }
- function CheckSurround(CheckPlaceX, CheckPlaceY)
- {
- if(checkedArray[CheckPlaceX][CheckPlaceY] == false)
- {
- waiting = _root.theScript.ApplesWaiting[CheckPlaceX][CheckPlaceY];
- if(waiting == true)
- {
- checkedArray[checkPlaceX][CheckPlaceY] = true;
- tempPlace = (CheckPlaceY - 1) * _root.theScript.numX + CheckPlaceX - 1;
- tempCount = getNumberSurrounding(CheckPlaceX,CheckPlaceY);
- _root.theScript.tempcount[tempPlace] = tempcount;
- _root.thescript.numleft -= 1;
- if(eval("/thescript:numleft") == 0)
- {
- set("/thescript:stopclick",true);
- }
- tellTarget("/apple" add CheckPlaceX add CheckPlaceY)
- {
- gotoAndStop("Good");
- play();
- }
- if(tempCount == 0)
- {
- clearSurounding(CheckPlaceX,CheckPlaceY);
- }
- }
- }
- }
- function clearChecked()
- {
- checkedArray = new Array();
- countX = 1;
- countY = 1;
- while(eval("/thescript:numx") >= countx)
- {
- var checkedRow = new Array();
- while(eval("/thescript:numy") >= county)
- {
- checkedrow[county] = false;
- county += 1;
- }
- county = 1;
- checkedArray[countx] = checkedRow;
- countx += 1;
- }
- }
- function printArray()
- {
- countX = 1;
- countY = 1;
- while(eval("/thescript:numx") >= countx)
- {
- while(eval("/thescript:numy") >= county)
- {
- county += 1;
- }
- county = 1;
- countx += 1;
- }
- }
- appleWaiting = true;
-