home *** CD-ROM | disk | FTP | other *** search
- package asCode
- {
- import com.terry.SeededRandomNumber;
- import flash.display.MovieClip;
- import flash.geom.*;
-
- public class nextThingFinder
- {
- private static var BUBBLE_TYPE_PLAYER:int = 0;
-
- private static var BUBBLE_TYPE_ACORN:int = 5;
-
- private static var BUBBLE_TYPE_HEALTH_POWERUP:int = 10;
-
- private static var BUBBLE_TYPE_INVINCIBLE:int = 15;
-
- private static var BUBBLE_TYPE_SHRINK:int = 20;
-
- private static var BUBBLE_TYPE_REVERSE:int = 25;
-
- private var _SeededRandomNumberRef:SeededRandomNumber;
-
- private var itemLocations:Array;
-
- private var level:int;
-
- private var rCell:int;
-
- private var powerUpChoice:int;
-
- private var r:int;
-
- private var _gameClipClassRef:gameClipClass;
-
- private var _findClearOfBitmapRef:findClearOfBitmap;
-
- private var levelStorageArray:Array;
-
- private var bubblesArray:Array;
-
- private var _tempArray:Array;
-
- private var _itemArray:Array;
-
- private var totalLevelCells:int;
-
- private var k:int;
-
- private var _clip:MovieClip;
-
- private var levelAcornAmount:int;
-
- private var itemBubbleSize:Number;
-
- private var _itemBubbleRef:itemBubbleCodeClass;
-
- private var _tempPoint:Point;
-
- public function nextThingFinder(param1:gameClipClass)
- {
- _SeededRandomNumberRef = new SeededRandomNumber();
- itemLocations = new Array();
- levelStorageArray = new Array();
- bubblesArray = new Array();
- _tempArray = new Array();
- _itemArray = new Array();
- _tempPoint = new Point();
- super();
- _gameClipClassRef = param1;
- _findClearOfBitmapRef = _gameClipClassRef._findClearOfBitmapRef;
- }
-
- public function resetForNextLevel() : void
- {
- level = _gameClipClassRef.level;
- levelStorageArray = new Array();
- bubblesArray = new Array();
- _SeededRandomNumberRef.seed = level * _gameClipClassRef.characterChoice;
- }
-
- public function findNextBackgroundType(param1:int = 0) : int
- {
- level = _gameClipClassRef.level;
- if(level == 1 || level == 4 || level == 7)
- {
- r = _SeededRandomNumberRef.nextIntRange(0,4);
- }
- if(level == 2 || level == 5 || level == 8)
- {
- r = _SeededRandomNumberRef.nextIntRange(5,9);
- }
- if(level == 3 || level == 6 || level == 9 || level == 10)
- {
- r = _SeededRandomNumberRef.nextIntRange(10,14);
- }
- return r;
- }
-
- public function findNextForegroundType(param1:String) : int
- {
- r = _SeededRandomNumberRef.nextIntRange(1,10);
- if(level == 1 || level == 4 || level == 7)
- {
- }
- if(level == 2 || level == 5 || level == 8)
- {
- r += 10;
- }
- if(level == 3 || level == 6 || level == 9 || level == 10)
- {
- r += 20;
- }
- if(param1 == "left")
- {
- return r;
- }
- return r + 99;
- }
-
- public function findNextScreenCellType(param1:int, param2:Number) : int
- {
- var _loc3_:int = 0;
- levelStorageArray = _gameClipClassRef.levelStorageArray;
- bubblesArray = _gameClipClassRef.bubblesArray;
- totalLevelCells = _gameClipClassRef.totalLevelCells;
- itemBubbleSize = _gameClipClassRef.itemBubbleSize;
- levelAcornAmount = _gameClipClassRef.levelAcornAmount;
- level = _gameClipClassRef.level;
- if(levelStorageArray[param1] == undefined || levelStorageArray[param1] == "")
- {
- if(level == 1)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(2,8);
- }
- if(level == 2)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(12,19);
- }
- if(level == 3)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(24,31);
- }
- if(level == 4 || level == 7)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(2,11);
- }
- if(level == 5 || level == 8)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(12,23);
- }
- if(level == 6 || level == 9 || level == 10)
- {
- rCell = _SeededRandomNumberRef.nextIntRange(24,34);
- }
- if(param1 > totalLevelCells)
- {
- rCell = 35;
- }
- if(param1 == 0)
- {
- rCell = 0;
- }
- if(param1 == 1)
- {
- rCell = 36;
- }
- if(param1 == totalLevelCells)
- {
- rCell = 1;
- }
- _tempArray = [];
- _tempArray[0] = rCell;
- if(param1 > 1 && param1 < totalLevelCells)
- {
- _itemArray = [];
- _loc3_ = _SeededRandomNumberRef.nextIntRange(0,6) + 1;
- itemLocations = _findClearOfBitmapRef.getEmptySpaces(rCell,_loc3_);
- k = 0;
- while(k < _loc3_)
- {
- _clip = new bubbleClip();
- ++levelAcornAmount;
- if(_SeededRandomNumberRef.nextDouble() < 0.15)
- {
- if(level < 5)
- {
- powerUpChoice = _SeededRandomNumberRef.nextIntRange(0,4);
- }
- else
- {
- powerUpChoice = _SeededRandomNumberRef.nextIntRange(0,3);
- }
- switch(powerUpChoice)
- {
- case 0:
- _clip.gotoAndStop(3);
- _itemBubbleRef = new itemBubbleCodeClass(_clip,itemBubbleSize,BUBBLE_TYPE_INVINCIBLE,false);
- break;
- case 1:
- _clip.gotoAndStop(4);
- _itemBubbleRef = new itemBubbleCodeClass(_clip,itemBubbleSize,BUBBLE_TYPE_HEALTH_POWERUP,false);
- break;
- case 2:
- _clip.gotoAndStop(5);
- _itemBubbleRef = new itemBubbleCodeClass(_clip,itemBubbleSize,BUBBLE_TYPE_SHRINK,false);
- break;
- case 3:
- _clip.gotoAndStop(6);
- _itemBubbleRef = new itemBubbleCodeClass(_clip,itemBubbleSize,BUBBLE_TYPE_REVERSE,false);
- }
- _tempPoint.x = itemLocations[k * 2];
- _tempPoint.y = itemLocations[k * 2 + 1] + param2;
- _itemBubbleRef.setLoc(_tempPoint);
- bubblesArray.push(_itemBubbleRef);
- _itemArray.push(_itemBubbleRef);
- }
- else
- {
- _clip.gotoAndStop(2);
- _itemBubbleRef = new itemBubbleCodeClass(_clip,itemBubbleSize,BUBBLE_TYPE_ACORN,false);
- _tempPoint.x = itemLocations[k * 2];
- _tempPoint.y = itemLocations[k * 2 + 1] + param2;
- _itemBubbleRef.setLoc(_tempPoint);
- bubblesArray.push(_itemBubbleRef);
- _itemArray.push(_itemBubbleRef);
- }
- ++k;
- }
- _tempArray[1] = _itemArray;
- }
- levelStorageArray[param1] = _tempArray;
- _gameClipClassRef.levelStorageArray = levelStorageArray;
- _gameClipClassRef.bubblesArray = bubblesArray;
- _gameClipClassRef.levelAcornAmount = levelAcornAmount;
- return rCell;
- }
- return levelStorageArray[param1][0];
- }
- }
- }
-
-