Frame 2
function loadGame() {
var _local3 = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
var _local2 = _root._framesloaded;
if (_local2 <= 100) {
_root._preloader.done_txt.text = _local2 + "%";
} else {
currentFrame++;
}
_root._preloader.gotoAndStop(currentFrame);
if (currentFrame == 40) {
clearInterval(loadInt);
gotoAndPlay (100);
}
}
var currentFrame = 1;
loadInt = setInterval(loadGame, 31);
stop();
Frame 105
stop();
Symbol 16 MovieClip [Particle_Heart] Frame 12
Symbol 26 MovieClip Frame 12
gotoAndPlay (1);
Symbol 38 MovieClip Frame 30
gotoAndPlay (1);
Symbol 147 MovieClip [Particle_Leaf] Frame 15
Symbol 148 MovieClip [Particle_Fire] Frame 15
Symbol 149 MovieClip [Particle_Water] Frame 15
Symbol 154 MovieClip [ReductionTally] Frame 16
stop();
Symbol 157 MovieClip [__Packages.Base.GameEntry] Frame 0
class Base.GameEntry extends MovieClip
{
static var _gamePaused, _gameOver;
var _timeMgr, _uiMgr, _padMgr, _gameMgr, _parent, _gameData, _profiler, _background, _gameLoaded, _stageLoaded, onEnterFrame, _multiplayer;
function GameEntry () {
super();
_gamePaused = false;
_gameOver = false;
_timeMgr = new Base.Time();
_uiMgr = new UI.UIManager(this);
_padMgr = new Pad.PadManager();
_gameMgr = new Game.GameManager(_parent);
_gameData = new Game.GameData(this);
_profiler = new Base.Profile(this);
_profiler.RegisterProfile("Game");
_background = new Base.Background(this);
_gameLoaded = false;
_stageLoaded = 1;
onEnterFrame = Update;
}
function getDT() {
return(_timeMgr.getElapsedTime());
}
function getParent() {
return(_parent);
}
function getTimeManager() {
return(_timeMgr);
}
function getGameManager() {
return(_gameMgr);
}
function getPadManager() {
return(_padMgr);
}
function getGameData() {
return(_gameData);
}
function getUIManager() {
return(_uiMgr);
}
function isMultiplayer() {
return(_multiplayer);
}
function getProfiler() {
return(_profiler);
}
function getBackground() {
return(_background);
}
function getStageLoaded() {
return(_stageLoaded);
}
function Update() {
_timeMgr.markTimeThisTick();
_padMgr.Update(this);
_uiMgr.Update();
_gameMgr.Update(this);
_background.moveBack(this);
return(undefined);
}
}
Symbol 158 MovieClip [__Packages.Base.Time] Frame 0
class Base.Time
{
var _currentTime, _timeLastTick, _gameSpeed, _startTime, _averageTime, _currentPlaceInAvgArray;
function Time () {
_currentTime = 0;
_timeLastTick = 0.001;
_gameSpeed = INITIAL_GAME_SPEED;
_startTime = (getTimer() * INITIAL_GAME_SPEED) / 1000;
_averageTime = new Array(0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666);
_currentPlaceInAvgArray = 0;
_currentTime = getTimer();
}
function getElapsedTime() {
return(_timeLastTick);
}
function getCurTime() {
return(_currentTime);
}
function getGameSpeed() {
return(_gameSpeed);
}
function getAverageTime() {
var _local3 = 0;
var _local2 = 0;
while (_local2 < 10) {
_local3 = _local3 + _averageTime[_local2];
_local2++;
}
_local3 = _local3 / 10;
return(_local3);
}
function getFramerate() {
return(Math.floor(1 / getAverageTime()));
}
function markTimeThisTick() {
var _local2 = ((getTimer() * _gameSpeed) / 1000) - _startTime;
_timeLastTick = _local2 - _currentTime;
_currentTime = _local2;
_averageTime[_currentPlaceInAvgArray++] = _timeLastTick;
if (_currentPlaceInAvgArray >= 10) {
_currentPlaceInAvgArray = 0;
}
if (_timeLastTick <= 0) {
_timeLastTick = 0.001;
}
}
function setGameSpeed(speed) {
_gameSpeed = speed;
if (_gameSpeed < MIN_GAME_SPEED) {
_gameSpeed = MIN_GAME_SPEED;
} else if (_gameSpeed > MAX_GAME_SPEED) {
_gameSpeed = MIN_GAME_SPEED;
}
}
static var INITIAL_GAME_SPEED = 1;
static var MIN_GAME_SPEED = 0.001;
static var MAX_GAME_SPEED = 100;
}
Symbol 159 MovieClip [__Packages.UI.UIManager] Frame 0
class UI.UIManager
{
var _gameContext, _screen, _uiReturnVal, _children, _cursor, _cursorOn, _nonBufferCursor, _scoreBoard;
function UIManager (gameContext) {
_gameContext = gameContext;
}
function Update() {
if (_screen == undefined) {
return(undefined);
}
_uiReturnVal = -1;
updateCursor();
updateScoreboard();
var _local3 = 0;
while (_local3 < _screen.getNumChildren()) {
var _local2 = _screen.getChildName(_local3);
if (_screen.isChildAnimating(_local2)) {
_screen.animateChild(_local2);
}
if (!_screen.getChildSelectable(_local2)) {
} else {
var _local8 = _children[_local3][5];
var _local5 = _children[_local3][6];
var _local9 = _children[_local3][7];
var _local10 = _children[_local3][8];
switch (_screen.getChildSelectable(_local2)) {
case 1 :
if (_screen.isMouseOverChild(_local2)) {
if ((!_screen.isChildAnimating(_local2)) && (_screen.getChildCurrentAnimFrame(_local2) <= _local8)) {
cursorOn();
_screen.startAnimatingChild(_local2, _local8, _local5, _local9, _local10);
}
if (_screen.getChildSelectOnKeyDown(_local2) && (_gameContext.getPadManager().getMouseJustPressed())) {
cursorOff();
_uiReturnVal = _screen.getChildReturnVal(_local2);
} else if ((!_screen.getChildSelectOnKeyDown(_local2)) && (_gameContext.getPadManager().getMouseReleased())) {
cursorOff();
_uiReturnVal = _screen.getChildReturnVal(_local2);
}
} else if ((!_screen.isChildAnimating(_local2)) && (_screen.getChildCurrentAnimFrame(_local2) == _local5)) {
_local8 = _children[_local3][6];
_local5 = _children[_local3][5];
cursorOff();
_screen.startAnimatingChild(_local2, _local8, _local5, _local9, _local10);
}
break;
case 2 :
var _local11 = _screen.getChildMouseIsOver();
if (_local11 != null) {
cursorOn();
if (_screen.isMouseOverChild(_local2)) {
if (_screen.getChildSelectOnKeyDown(_local2) && (_gameContext.getPadManager().getMouseJustPressed())) {
_screen.moveChildToFrame(_local2, _local5);
setUIReturnVal(_screen.getChildReturnVal(_local2));
var _local4 = 0;
while (_children[_local3][11][_local4] != undefined) {
var _local6 = _screen.getChildName(_children[_local3][11][_local4]);
var _local7 = _children[_local4][5];
_screen.moveChildToFrame(_local6, _local7);
_local4++;
}
} else if ((!_screen.getChildSelectOnKeyDown(_local2)) && (_gameContext.getPadManager().getMouseReleased())) {
_screen.moveChildToFrame(_local2, _local5);
setUIReturnVal(_screen.getChildReturnVal(_local2));
var _local4 = 0;
while (_children[_local3][11][_local4] != undefined) {
var _local6 = _screen.getChildName(_children[_local3][11][_local4]);
var _local7 = _children[_local4][5];
_screen.moveChildToFrame(_local6, _local7);
_local4++;
}
}
}
} else {
cursorOff();
}
break;
}
}
_local3++;
}
}
function moveScreenToFrame(num) {
_screen.moveToFrame(num);
}
function setUIReturnVal(val) {
_uiReturnVal = val;
}
function getUIReturnVal() {
return(_uiReturnVal);
}
function getScreen() {
return(_screen);
}
function showScreen(screen, initFrame, defaultSetting) {
if (_screen != undefined) {
removeScreen();
}
_screen = new Base.SpriteEntity(_gameContext, screen.id, screen.idx, screen.spriteName, screen.clipName, screen.depth, screen.xPos, screen.yPos, screen.regPt, screen.w, screen.h);
_children = screen.children;
var _local3 = 0;
var _local8 = 0;
if (initFrame != undefined) {
_local8 = initFrame;
}
_screen.moveToFrame(_local8);
while (_children[_local3][0] != undefined) {
_screen.addChild(screen.children[_local3][0], screen.children[_local3][1], screen.children[_local3][2], screen.children[_local3][3], screen.children[_local3][4], screen.children[_local3][9], screen.children[_local3][10]);
_local3++;
}
var _local4 = 0;
while (defaultSetting[_local4] != undefined) {
var _local5 = _children[defaultSetting[_local4]][0];
var _local6 = _children[defaultSetting[_local4]][6];
_screen.moveChildToFrame(_local5, _local6);
_local4++;
}
}
function removeScreen() {
_screen.removeSprite();
delete _screen;
}
function setCursor(sprite) {
_cursor = new Base.SpriteEntity(_gameContext, sprite.id, sprite.idx, sprite.spriteName, sprite.clipName, sprite.depth, sprite.xPos, sprite.yPos, sprite.regPt, sprite.w, sprite.h);
_cursor.setVisibility(false);
_cursorOn = false;
}
function cursorOn() {
if (_cursorOn == true) {
return(undefined);
}
_cursorOn = true;
updateCursor();
_cursor.setVisibility(true);
}
function cursorOff() {
if (_cursorOn == false) {
return(undefined);
}
_cursorOn = false;
_cursor.setVisibility(false);
}
function updateCursor() {
if (_cursorOn) {
_cursor.setPositionX(_gameContext.getPadManager().getMousePosX());
_cursor.setPositionY(_gameContext.getPadManager().getMousePosY());
}
}
function setNonBufferCursorPosition() {
_nonBufferCursor.setPositionX(_gameContext.getPadManager().getMousePosX());
_nonBufferCursor.setPositionY(_gameContext.getPadManager().getMousePosY());
}
function getCursor() {
return(_cursor);
}
function addScoreboard(sprite) {
}
function updateScoreboard() {
if (_scoreBoard == undefined) {
return(undefined);
}
}
}
Symbol 160 MovieClip [__Packages.Base.SpriteEntity] Frame 0
class Base.SpriteEntity
{
var _entityType, _id, _spName, _clName, _gameContext, _mc, _clipWidth, _clipHeight, _centerPoint, _startFrame, _endFrame, _framerate, _loopAnim, _animate, _animateTimer, _lastFrame, _c, _flipped, _mouseIsOver, _mouseRollOn, _mouseRollOff, _children, _collideOffsetX, _collideOffsetY, _moveSpeed, _destPosX, _destPosY, _startingPositionX, _startingPositionY, _depth, _faceDir;
function SpriteEntity (gameContext, eType, id, spName, clName, depth, posX, posY, centerPoint, wth, hgt) {
_entityType = eType;
_id = id;
_spName = spName;
_clName = clName;
_gameContext = gameContext;
_mc = _gameContext.getParent().attachMovie(spName, clName, depth);
_mc._visible = true;
_mc._x = posX;
_mc._y = posY;
_clipWidth = ((wth > 0) ? (wth) : (_mc._width));
_clipHeight = ((hgt > 0) ? (hgt) : (_mc._height));
_centerPoint = centerPoint;
_startFrame = 0;
_endFrame = 0;
_framerate = 30;
_loopAnim = false;
_animate = false;
_animateTimer = 0;
_lastFrame = 0;
_c = 1;
_flipped = false;
_mc.gotoAndStop(_c);
_mc.createEmptyMovieClip("lines", depth + 200000);
_mouseIsOver = false;
_mouseRollOn = false;
_mouseRollOff = false;
_children = [];
_collideOffsetX = 0;
_collideOffsetY = 0;
}
function setMoveSpeed(speed) {
_moveSpeed = speed;
}
function setDestPosX(pos) {
_destPosX = pos;
}
function setDestPosY(pos) {
_destPosY = pos;
}
function setStartingPositionToPosition() {
_startingPositionX = getPositionX();
_startingPositionY = getPositionY();
}
function getMoveSpeed() {
return(_moveSpeed);
}
function getDestPosX() {
return(_destPosX);
}
function getDestPosY() {
return(_destPosY);
}
function getStartingPositionX() {
return(_startingPositionX);
}
function getStartingPositionY() {
return(_startingPositionY);
}
function setCollideOffsetXY(x, y) {
_collideOffsetX = x;
_collideOffsetY = y;
}
function getCollideOffsetX() {
return(_collideOffsetX);
}
function getCollideOffsetY() {
return(_collideOffsetY);
}
function isAtDestination() {
return((((_mc._x == _destPosX) && (_mc._y == _destPosY)) ? true : false));
}
function createChild(childName, upperLeftX, upperLeftY, w, h, isSelectable, returnVal) {
_depth = getZDepth();
_children.push(childName + returnVal);
_mc[childName + returnVal] = _mc.attachMovie(childName, ("minor_token" + (_depth * 10)) + returnVal, (_depth * 10) + returnVal);
_mc[childName + returnVal]._x = w;
_mc[childName + returnVal]._animiateChild = false;
_mc[childName + returnVal]._lastChildFrame = 0;
_mc[childName + returnVal]._startChildFrame = 1;
_mc[childName + returnVal]._endChildFrame = 1;
_mc[childName + returnVal]._childFramerate = 60;
_mc[childName + returnVal]._childAnimateTimer = 0;
_mc[childName + returnVal]._looping = false;
_mc[childName + returnVal]._isSelectable = isSelectable & 127;
_mc[childName + returnVal]._selectOnKeyDown = isSelectable >> 7;
_mc[childName + returnVal]._returnVal = returnVal;
_mc[childName + returnVal]._currentChildFrame = 0;
_mc[childName + returnVal]._upperLeftX = upperLeftX;
_mc[childName + returnVal]._upperLeftY = upperLeftY;
_mc[childName + returnVal]._w = w;
_mc[childName + returnVal]._h = h;
_mc[childName + returnVal].gotoAndStop(_mc[childName]._startChildFrame);
}
function changeChild(oldChildName, newChildName) {
var _local3 = _mc[oldChildName].getDepth();
var _local5 = _mc[oldChildName]._x;
var _local4 = _mc[oldChildName]._y;
_mc[oldChildName].removeMovieClip();
_mc[oldChildName] = _mc.attachMovie(newChildName, newChildName + _local3, _local3);
_mc[oldChildName]._visible = true;
_mc[oldChildName]._x = _local5;
_mc[oldChildName]._y = _local4;
}
function addChild(childName, upperLeftX, upperLeftY, w, h, isSelectable, returnVal) {
_children.push(childName);
_mc[childName]._animiateChild = false;
_mc[childName]._lastChildFrame = 0;
_mc[childName]._startChildFrame = 1;
_mc[childName]._endChildFrame = 1;
_mc[childName]._childFramerate = 60;
_mc[childName]._childAnimateTimer = 0;
_mc[childName]._looping = false;
_mc[childName]._isSelectable = isSelectable & 127;
_mc[childName]._selectOnKeyDown = isSelectable >> 7;
_mc[childName]._returnVal = returnVal;
_mc[childName]._currentChildFrame = 0;
_mc[childName]._upperLeftX = upperLeftX;
_mc[childName]._upperLeftY = upperLeftY;
_mc[childName]._w = w;
_mc[childName]._h = h;
_mc[childName]._animateIncrement = 1;
_mc[childName].gotoAndStop(_mc[childName]._startChildFrame);
}
function getMovieClip() {
return(_mc);
}
function getType() {
return(_entityType);
}
function setZDepth(depth) {
_mc.swapDepths(depth);
}
function getZDepth() {
return(_mc.getDepth());
}
function moveToFrame(frame) {
_mc.gotoAndStop(frame);
_lastFrame = frame;
}
function getCurrentFrame() {
return(_mc._currentframe);
}
function setPosition(x, y) {
_mc._x = x;
_mc._y = y;
}
function setPositionX(x) {
_mc._x = x;
}
function setPositionY(y) {
_mc._y = y;
}
function adjustPositionX(amt) {
_mc._x = _mc._x + amt;
}
function adjustPositionY(amt) {
_mc._y = _mc._y + amt;
}
function setPositionXY(x, y) {
setPositionX(x);
setPositionY(y);
}
function movePositionXY(x, y) {
setPositionX(_mc._x + x);
setPositionY(_mc._y + y);
}
function setVisibility(vis) {
_mc._visible = vis;
}
function getVisibility(Void) {
return(_mc._visible);
}
function setRotation(angle) {
_mc._rotation = angle;
}
function setFaceDir(num) {
_faceDir = num;
}
function getFaceDir() {
return(_faceDir);
}
function setFlipped() {
_flipped = (_flipped ? false : true);
_mc._xscale = _mc._xscale * -1;
}
function isFlipped() {
return(_flipped);
}
function playFlipped() {
if (_flipped) {
return(undefined);
}
_flipped = true;
_mc._xscale = _mc._xscale * -1;
}
function playUnflipped() {
if (_flipped) {
_mc._xscale = _mc._xscale * -1;
}
_flipped = false;
}
function changeSprite(spName, clName) {
var _local4 = _mc.getDepth();
var _local3 = _mc._x;
var _local2 = _mc._y;
_mc.removeMovieClip();
_spName = spName;
_clName = clName;
_mc = _gameContext.getParent().attachMovie(spName, clName, _local4);
_mc._visible = true;
_mc._x = _local3;
_mc._y = _local2;
}
function startAnimating(startFrame, endFrame, framerate, loopAnim, fromFrame) {
_c = startFrame;
_startFrame = startFrame;
_endFrame = endFrame;
_framerate = 1 / framerate;
_loopAnim = loopAnim;
_animate = true;
_animateTimer = _framerate;
if (fromFrame != undefined) {
moveToFrame(fromFrame);
} else {
moveToFrame(startFrame);
}
}
function getStartFrame() {
return(_startFrame);
}
function animateSprite() {
_animateTimer = _animateTimer - _gameContext.getDT();
if (_animateTimer <= 0) {
_animateTimer = _framerate;
if (_startFrame <= _endFrame) {
_c++;
if (_c > _endFrame) {
if (_loopAnim) {
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return(1);
}
}
} else {
_c--;
if (_c < _endFrame) {
if (_loopAnim) {
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return(1);
}
}
}
moveToFrame(_c);
}
return(0);
}
function isAnimating() {
return(_animate);
}
function doneAnimating() {
_animate = false;
}
function startAnimatingChild(child, startFrame, endFrame, framerate, looping, fromFrame) {
_mc[child]._startChildFrame = startFrame;
_mc[child]._endChildFrame = endFrame;
_mc[child]._childFramerate = framerate;
_mc[child]._childAnimateTimer = 0;
_mc[child]._looping = looping;
if (fromFrame != undefined) {
_mc[child]._currentChildFrame = fromFrame;
} else {
_mc[child]._currentChildFrame = startFrame;
}
_mc[child]._animateChild = true;
_mc[child]._childAnimateTimer = 1 / _mc[child]._childFramerate;
_mc[child].gotoAndStop(_mc[child]._currentChildFrame);
}
function setChildAnimateIncrement(child, num) {
_mc[child]._animateIncrement = num;
}
function animateChild(child) {
if (!_mc[child]._animateChild) {
return(undefined);
}
if (_mc[child]._childFramerate == 0) {
return(undefined);
}
_mc[child]._childAnimateTimer = _mc[child]._childAnimateTimer - _gameContext.getDT();
if (_mc[child]._childAnimateTimer <= 0) {
_mc[child]._childAnimateTimer = 1 / _mc[child]._childFramerate;
if (_mc[child]._startChildFrame < _mc[child]._endChildFrame) {
_mc[child]._currentChildFrame = _mc[child]._currentChildFrame + _mc[child]._animateIncrement;
if (_mc[child]._currentChildFrame > _mc[child]._endChildFrame) {
if (_mc[child]._looping) {
_mc[child]._currentChildFrame = _mc[child]._startChildFrame + (_mc[child]._currentChildFrame - _mc[child]._endChildFrame);
} else {
childDoneAnimating(child);
_mc[child]._currentChildFrame = _mc[child]._endChildFrame;
}
}
} else {
_mc[child]._currentChildFrame--;
if (_mc[child]._currentChildFrame < _mc[child]._endChildFrame) {
if (_mc[child]._looping) {
_mc[child]._currentChildFrame = _mc[child]._startChildFrame;
} else {
childDoneAnimating(child);
_mc[child]._currentChildFrame = _mc[child]._endChildFrame;
}
}
}
_mc[child].gotoAndStop(_mc[child]._currentChildFrame);
}
}
function isMouseOverChild(child) {
if (_mc[child]._visible == false) {
return(false);
}
var _local4 = (_mc._x + _mc[child]._x) + _mc[child]._upperLeftX;
var _local6 = _local4 + _mc[child]._w;
var _local3 = (_mc._y + _mc[child]._y) + _mc[child]._upperLeftY;
var _local5 = _local3 + _mc[child]._h;
if ((((_gameContext.getPadManager().getMousePosX() < _local4) || (_gameContext.getPadManager().getMousePosX() > _local6)) || (_gameContext.getPadManager().getMousePosY() < _local3)) || (_gameContext.getPadManager().getMousePosY() > _local5)) {
return(false);
}
return(true);
}
function isBufferMouseOverChild(child) {
return(true);
}
function handCursor(child, use) {
_mc[child].useHandCursor = use;
}
function getNumChildren() {
return(_children.length);
}
function getChildName(idx) {
return(_children[idx]);
}
function getChild(child) {
return(_mc[child]);
}
function getChildMouseIsOver() {
var _local3 = _children.length;
var _local2 = 0;
while (_local2 < _local3) {
if (isMouseOverChild(_children[_local2])) {
return(_children[_local2]);
}
_local2++;
}
return(null);
}
function getChildCurrentAnimFrame(child) {
return(_mc[child]._currentChildFrame);
}
function getChildStartFrame(child) {
return(_mc[child]._startChildFrame);
}
function getChildEndFrame(child) {
return(_mc[child]._endChildFrame);
}
function setChildFramerate(child, rate) {
_mc[child]._childFramerate = rate;
}
function getChildFramerate(child) {
return(_mc[child]._childFramerate);
}
function getChildLooping(child) {
return(_mc[child]._looping);
}
function getChildSelectable(child) {
return(_mc[child]._isSelectable);
}
function getChildSelectOnKeyDown(child) {
return(_mc[child]._selectOnKeyDown);
}
function getChildReturnVal(child) {
return(_mc[child]._returnVal);
}
function childDoneAnimating(child) {
_mc[child]._animateChild = false;
}
function isChildAnimating(child) {
return(_mc[child]._animateChild);
}
function moveChildToFrame(child, frame) {
_mc[child].gotoAndStop(frame);
}
function getID() {
return(_id);
}
function getGameContext() {
return(_gameContext);
}
function getPositionX() {
return(_mc._x);
}
function getPositionY() {
return(_mc._y);
}
function getArea() {
return(_clipWidth * _clipHeight);
}
function setWidth(w) {
_clipWidth = w;
}
function getWidth() {
return(_clipWidth);
}
function getHeight() {
return(_clipHeight);
}
function getClipName() {
return(_clName);
}
function isVisible() {
return(_mc._visible);
}
function scaleSprite(scale) {
_mc._xscale = _mc._xscale * scale;
_mc._yscale = _mc._yscale * scale;
}
function removeSprite() {
_mc.removeMovieClip();
}
function isMouseRollOn() {
return(_mouseRollOn);
}
function isMouseRollOff() {
return(_mouseRollOff);
}
function isMouseOver(offsetX, offsetY) {
var _local6 = false;
if (offsetX == undefined) {
offsetX = 0;
}
if (offsetY == undefined) {
offsetY = 0;
}
if (_mouseIsOver) {
_mouseRollOn = false;
_local6 = true;
} else {
_mouseRollOn = true;
}
_mouseRollOff = false;
_mouseIsOver = false;
if (_mc._visible == false) {
return(false);
}
var _local4 = _mc._x - (_clipWidth / 2);
var _local5 = _mc._x + (_clipWidth / 2);
var _local2 = _mc._y - _clipHeight;
var _local3 = _mc._y;
if (_centerPoint == 1) {
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 2) {
_local4 = _mc._x;
_local5 = _mc._x + _clipWidth;
_local2 = _mc._y;
_local3 = _mc._y + _clipHeight;
}
if (_centerPoint == 3) {
_local4 = _mc.x - _clipWidth;
_local5 = _mc.x;
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 4) {
_local4 = _mc._x + 10;
_local5 = _mc._x + 40;
_local2 = _mc._y - 35;
_local3 = _mc._y + 35;
}
if (((((_gameContext.getPadManager().getMousePosX() + offsetX) < _local4) || ((_gameContext.getPadManager().getMousePosX() + offsetX) > _local5)) || ((_gameContext.getPadManager().getMousePosY() + offsetY) < _local2)) || ((_gameContext.getPadManager().getMousePosY() + offsetY) > _local3)) {
if (_local6) {
_mouseRollOff = true;
}
return(false);
}
_mouseIsOver = true;
return(true);
}
function getLeftX() {
var _local2 = _mc._x - (_clipWidth / 2);
if (_centerPoint == 2) {
_local2 = _mc._x;
}
if (_centerPoint == 3) {
_local2 = _mc.x - _clipWidth;
}
if (_centerPoint == 4) {
_local2 = _mc._x + 10;
}
_local2 = _local2 + _collideOffsetX;
return(_local2);
}
function getUpperY() {
var _local2 = _mc._y - _clipHeight;
if (_centerPoint == 1) {
_local2 = _mc._y - (_clipHeight / 2);
}
if (_centerPoint == 2) {
_local2 = _mc._y;
}
if (_centerPoint == 3) {
_local2 = _mc._y - (_clipHeight / 2);
}
if (_centerPoint == 4) {
_local2 = _mc._y - 35;
}
_local2 = _local2 + _collideOffsetY;
return(_local2);
}
function getRightX() {
var _local2 = _mc._x + (_clipWidth / 2);
if (_centerPoint == 2) {
_local2 = _mc._x + _clipWidth;
}
if (_centerPoint == 3) {
_local2 = _mc.x;
}
if (_centerPoint == 4) {
_local2 = _mc._x + 40;
}
return(_local2);
}
function getLowerY() {
var _local2 = _mc._y;
if (_centerPoint == 1) {
_local2 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 2) {
_local2 = _mc._y + _clipHeight;
}
if (_centerPoint == 3) {
_local2 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 4) {
_local2 = _mc._y + 35;
}
return(_local2);
}
function amCollidingWithStaticRectangle() {
var _local4 = _mc._x - (_clipWidth / 2);
var _local5 = _mc._x + (_clipWidth / 2);
var _local2 = _mc._y - _clipHeight;
var _local3 = _mc._y;
if (_centerPoint == 1) {
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 2) {
_local4 = _mc._x;
_local5 = _mc._x + _clipWidth;
_local2 = _mc._y;
_local3 = _mc._y + _clipHeight;
}
if (_centerPoint == 3) {
_local4 = _mc.x - _clipWidth;
_local5 = _mc.x;
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 4) {
_local4 = _mc._x + 10;
_local5 = _mc._x + 40;
_local2 = _mc._y - 35;
_local3 = _mc._y + 35;
}
return(false);
}
function drawDebugLines() {
var _local3 = -(_clipWidth / 2);
var _local2 = -_clipHeight;
var _local5 = _clipWidth / 2;
var _local4 = 0;
if (_centerPoint == 1) {
_local2 = -(_clipHeight / 2);
_local4 = _clipHeight / 2;
}
if (_centerPoint == 2) {
_local3 = 0;
_local2 = 0;
_local5 = _clipWidth;
_local4 = _clipHeight;
}
if (_centerPoint == 3) {
_local3 = -_clipWidth;
_local2 = -(_clipHeight / 2);
}
if (_centerPoint == 4) {
}
_mc.lines.clear();
_mc.lines.lineStyle(1, 16711935, 100);
_mc.lines.moveTo(_local3 + _collideOffsetX, _local2 + _collideOffsetY);
_mc.lines.lineTo(_local5 - _collideOffsetX, _local2 + _collideOffsetY);
_mc.lines.lineTo(_local5 - _collideOffsetX, _local4);
_mc.lines.lineTo(_local3 + _collideOffsetX, _local4);
_mc.lines.lineTo(_local3 + _collideOffsetX, _local2 + _collideOffsetY);
}
function drawAsSelected() {
var _local3 = -(_clipWidth / 2);
var _local2 = -_clipHeight;
var _local5 = _clipWidth / 2;
var _local4 = 0;
if (_centerPoint == 1) {
_local2 = -(_clipHeight / 2);
_local4 = _clipHeight / 2;
}
if (_centerPoint == 2) {
_local3 = 0;
_local2 = 0;
_local5 = _clipWidth;
_local4 = _clipHeight;
}
if (_centerPoint == 3) {
_local3 = -_clipWidth;
_local2 = -(_clipHeight / 2);
}
if (_centerPoint == 4) {
}
_mc.clear();
_mc.blendMode = "multiply";
_mc.beginFill(8355711, 100);
_mc.moveTo(_local3, _local2);
_mc.lineTo(_local5, _local2);
_mc.lineTo(_local5, _local4);
_mc.lineTo(_local3, _local4);
_mc.lineTo(_local3, _local2);
_mc.endFill();
}
function drawAsUnselected() {
_mc.clear();
_mc.blendMode = "normal";
}
var test = [];
}
Symbol 161 MovieClip [__Packages.Pad.PadManager] Frame 0
class Pad.PadManager
{
var _padData, _lastKeyPressed, _lastKeyReleaseTime, _keyTargeting, _mouseData, _keyTarget;
function PadManager () {
_padData = new Array();
_lastKeyPressed = 0;
_lastKeyReleaseTime = 0;
_keyTargeting = false;
_mouseData = new Object();
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseTimePressed = 0;
_mouseData.mousePressedPosX = 0;
_mouseData.mousePressedPosY = 0;
_mouseData.mousePosX = 0;
_mouseData.mousePosY = 0;
Init();
}
function getPadData() {
return(_padData);
}
function getPadDataLength() {
return(_padData.length);
}
function getKeyJustPressed(id) {
return(_padData[id].keyPressed);
}
function getKeyStillPressed(id) {
return(_padData[id].keyStillPressed);
}
function getCtrlDown() {
if (Key.isDown(17)) {
return(true);
}
return(false);
}
function getShiftDown() {
if (Key.isDown(16)) {
return(true);
}
return(false);
}
function getCurrentKeyAction(Void) {
var _local2 = 0;
while (_local2 < _padData.length) {
if (_padData[_local2].keyPressed) {
return(_padData[_local2].keyAction);
}
_local2++;
}
return("");
}
function getCurrentKeyActionHeld(Void) {
var _local2 = 0;
while (_local2 < _padData.length) {
if (_padData[_local2].keyStillPressed) {
return(_padData[_local2].keyAction);
}
_local2++;
}
return("");
}
function getCurrentKeyActionUp(Void) {
var _local2 = 0;
while (_local2 < _padData.length) {
if (_padData[_local2].keyReleased) {
return(_padData[_local2].keyAction);
}
_local2++;
}
return("");
}
function getTimeKeyActionHeld(Void) {
var _local2 = 0;
while (_local2 < _padData.length) {
if (_padData[_local2].keyStillPressed) {
return(_padData[_local2].timePressed);
}
_local2++;
}
return(0);
}
function getKeyActionHeld(sAction) {
var _local2 = 0;
while (_local2 < _padData.length) {
if ((_padData[_local2].keyAction == sAction) && (_padData[_local2].keyStillPressed)) {
return(true);
}
_local2++;
}
return(false);
}
function getKeyDoubleTapped(sAction) {
var _local2 = 0;
while (_local2 < _padData.length) {
if ((_padData[_local2].keyAction == sAction) && (_padData[_local2].doubleTapped)) {
return(true);
}
_local2++;
}
return(false);
}
function getMouseJustPressed() {
return(_mouseData.mouseJustPressed);
}
function getMouseStillPressed() {
return(_mouseData.mouseStillPressed);
}
function getMouseReleased() {
return(_mouseData.mouseReleased);
}
function getMouseTimePressed() {
return(_mouseData.mouseTimePressed);
}
function getMousePressedPosX() {
return(_mouseData.mousePressedPosX);
}
function getMousePressedPosY() {
return(_mouseData.mousePressedPosY);
}
function getMousePosX() {
return(_mouseData.mousePosX);
}
function getMousePosY() {
return(_mouseData.mousePosY);
}
function Init() {
mouseListener.onMouseDown = function () {
_global.handleMousePress = true;
return(undefined);
};
mouseListener.onMouseUp = function () {
_global.handleMouseRelease = true;
return(undefined);
};
mouseListener.onMouseMove = null;
Mouse.addListener(mouseListener);
setKeyControls(_controls);
return(undefined);
}
function clearKeyControls() {
_padData = [];
}
function setKeyControls(oControls) {
var _local2 = 0;
while (_local2 < oControls.length) {
_padData.push({keyID:oControls[_local2].keyID, keyAction:oControls[_local2].keyAction, keyPressed:false, keyReleased:false, keyStillPressed:false, timePressed:0, doubleTapped:false});
_local2++;
}
}
function setKeyTarget(oTarget) {
_keyTargeting = true;
_keyTarget = oTarget;
}
function getKeyTarget(oTarget) {
return(_keyTarget);
}
function removeKeyTarget() {
_keyTargeting = false;
_keyTarget = null;
}
function Update(gameContext) {
if (_mouseData.mouseReleased) {
_mouseData.mouseReleased = false;
}
if (_global.handleMouseRelease) {
_global.handleMouseRelease = false;
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = true;
} else {
if (_mouseData.mouseJustPressed) {
_mouseData.mouseJustPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = true;
}
if (_mouseData.mouseStillPressed) {
_mouseData.mouseTimePressed = _mouseData.mouseTimePressed + gameContext.getDT();
}
}
if (_global.handleMousePress) {
_global.handleMousePress = false;
_mouseData.mouseJustPressed = true;
_mouseData.mousePressedPosX = _root._xmouse;
_mouseData.mousePressedPosY = _root._ymouse;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseTimePressed = 0;
}
_mouseData.mousePosX = _root._xmouse;
_mouseData.mousePosY = _root._ymouse;
var _local6 = Key.getCode();
var _local4 = 0;
while (_local4 < _padData.length) {
if (Key.isDown(_padData[_local4].keyID)) {
if ((!_padData[_local4].keyPressed) && (!_padData[_local4].keyStillPressed)) {
if (_padData[_local4].keyID == _lastKeyPressed) {
if ((gameContext.getTimeManager().getCurTime() - _lastKeyReleaseTime) < 0.18) {
_padData[_local4].doubleTapped = true;
}
}
_padData[_local4].keyPressed = true;
_padData[_local4].keyStillPressed = false;
_padData[_local4].keyReleased = false;
_padData[_local4].timePressed = 0;
} else if (_padData[_local4].keyPressed || (_padData[_local4].keyStillPressed)) {
_padData[_local4].keyPressed = false;
_padData[_local4].keyStillPressed = true;
_padData[_local4].keyReleased = false;
_padData[_local4].timePressed = _padData[_local4].timePressed + gameContext.getDT();
}
} else if (_padData[_local4].keyStillPressed || (_padData[_local4].keyPressed)) {
_padData[_local4].keyPressed = false;
_padData[_local4].keyStillPressed = false;
_padData[_local4].keyReleased = true;
_padData[_local4].doubleTapped = false;
_lastKeyPressed = _padData[_local4].keyID;
_lastKeyReleaseTime = gameContext.getTimeManager().getCurTime();
}
_local4++;
}
return(undefined);
}
function toString(Void) {
return("PadManager()");
}
var mouseListener = new Object();
var _controls = [{keyAction:"a", keyID:65}, {keyAction:"b", keyID:66}, {keyAction:"c", keyID:67}, {keyAction:"d", keyID:68}, {keyAction:"e", keyID:69}, {keyAction:"f", keyID:70}, {keyAction:"g", keyID:71}, {keyAction:"h", keyID:72}, {keyAction:"i", keyID:73}, {keyAction:"j", keyID:74}, {keyAction:"k", keyID:75}, {keyAction:"l", keyID:76}, {keyAction:"m", keyID:77}, {keyAction:"n", keyID:78}, {keyAction:"o", keyID:79}, {keyAction:"p", keyID:80}, {keyAction:"q", keyID:81}, {keyAction:"r", keyID:82}, {keyAction:"s", keyID:83}, {keyAction:"t", keyID:84}, {keyAction:"u", keyID:85}, {keyAction:"v", keyID:86}, {keyAction:"w", keyID:87}, {keyAction:"x", keyID:88}, {keyAction:"y", keyID:89}, {keyAction:"z", keyID:90}, {keyAction:"upArrow", keyID:38}, {keyAction:"downArrow", keyID:40}, {keyAction:"leftArrow", keyID:37}, {keyAction:"rightArrow", keyID:39}];
}
Symbol 162 MovieClip [__Packages.Game.GameManager] Frame 0
class Game.GameManager
{
var _currentGameState, _nextGameState, _followingGameState;
function GameManager (parentMC) {
_currentGameState = null;
setNextState(Game.GameStates.G_TitleCard);
}
function setNextState(state) {
_nextGameState = new state[undefined]();
}
function setFollowingGameState(state) {
_followingGameState = state;
}
function getFollowingGameState() {
return(_followingGameState);
}
function Update(gameContext) {
if (_nextGameState.isTransitioning()) {
return(undefined);
}
if (_currentGameState != _nextGameState) {
_currentGameState = _nextGameState;
_currentGameState.Entry(gameContext);
} else if (_currentGameState == _nextGameState) {
_currentGameState.PadInput(gameContext);
_currentGameState.Update(gameContext);
if (_currentGameState != _nextGameState) {
_currentGameState.Exit(gameContext);
delete _currentGameState;
if (!_nextGameState) {
}
}
}
}
}
Symbol 163 MovieClip [__Packages.Base.State] Frame 0
class Base.State
{
function State () {
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 164 MovieClip [__Packages.Base.GameState] Frame 0
class Base.GameState extends Base.State
{
static var _transition, _lastTransitionFrame, _screenFade, _fadeSpeed, _levelToReach, _currentAlphaVal, _isFading;
function GameState () {
super();
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
function startScreenTransition(gameContext, spriteName, startFrame, endFrame, frameRate, depth) {
_transition = new Base.SpriteEntity(gameContext, 5, 100, spriteName, spriteName, depth, 0, 0, -1, -1);
_transition.startAnimating(startFrame, endFrame, frameRate, false);
}
function getTransitionFrame() {
if (_transition) {
return(_transition.getCurrentFrame());
}
return(_lastTransitionFrame);
}
function isTransitioning() {
if (_transition) {
if (_transition.isAnimating()) {
_transition.animateSprite();
return(true);
}
_lastTransitionFrame = _transition.getCurrentFrame();
_transition.removeSprite();
delete _transition;
}
return(false);
}
function startFadeOut(gameContext, spriteName, clipName, depth, fadeSpeed, level) {
_screenFade = new Base.SpriteEntity(gameContext, 5, 100, spriteName, clipName, depth, 0, 0, 2, -1, -1);
_fadeSpeed = fadeSpeed;
_levelToReach = level;
_currentAlphaVal = 0;
_isFading = true;
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
function handleFadeOut() {
if (_isFading) {
_currentAlphaVal = _currentAlphaVal + _fadeSpeed;
if (_currentAlphaVal >= _levelToReach) {
_currentAlphaVal = _levelToReach;
_isFading = false;
}
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
}
function continueFadeOut(fadeSpeed, level) {
_isFading = true;
_levelToReach = level;
}
function startFadeIn(fadeSpeed) {
_isFading = true;
_levelToReach = 0;
_fadeSpeed = fadeSpeed;
}
function handleFadeIn() {
_currentAlphaVal = _currentAlphaVal - _fadeSpeed;
if (_currentAlphaVal <= _levelToReach) {
_currentAlphaVal = _levelToReach;
_isFading = false;
_screenFade.removeSprite();
delete _screenFade;
}
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
function isFading() {
return(_isFading);
}
function setFadeDepth(depth) {
_screenFade.setZDepth(depth);
}
}
Symbol 165 MovieClip [__Packages.Game.GameStates.G_TitleCard] Frame 0
class Game.GameStates.G_TitleCard extends Base.GameState
{
var _mouseOverButton, startScreenTransition;
function G_TitleCard () {
super();
}
function Entry(gameContext) {
gameContext.getUIManager().showScreen(gameContext.getGameData().getScreen(0));
_mouseOverButton = false;
}
function Update(gameContext) {
if (gameContext.getUIManager().getScreen().isMouseOverChild("btn_start")) {
if (!_mouseOverButton) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_OVER);
_mouseOverButton = true;
}
} else {
_mouseOverButton = false;
}
if (gameContext.getUIManager().getUIReturnVal() == 1) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_PRESS);
gameContext.getGameManager().setNextState(Game.GameStates.G_Instructions);
}
}
function Exit(gameContext) {
startScreenTransition(gameContext, "SCRN_Trans", 1, 10, 30, 20000);
}
}
Symbol 166 MovieClip [__Packages.Game.GameStates.G_Instructions] Frame 0
class Game.GameStates.G_Instructions extends Base.GameState
{
var startScreenTransition, _mouseOverButton;
function G_Instructions () {
super();
}
function Entry(gameContext) {
gameContext.getUIManager().showScreen(gameContext.getGameData().getScreen(1));
startScreenTransition(gameContext, "SCRN_Trans", 10, 1, 30, 20000);
}
function Update(gameContext) {
if (gameContext.getUIManager().getScreen().isMouseOverChild("btn_play")) {
if (!_mouseOverButton) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_OVER);
_mouseOverButton = true;
}
} else {
_mouseOverButton = false;
}
if (gameContext.getUIManager().getUIReturnVal() == 1) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_PRESS);
gameContext.getGameData().LoadTracking();
gameContext.getGameManager().setNextState(Game.GameStates.G_Inplay);
}
}
function Exit(gameContext) {
startScreenTransition(gameContext, "SCRN_Trans", 1, 10, 30, 20000);
}
}
Symbol 167 MovieClip [__Packages.Game.GameStates.G_Inplay] Frame 0
class Game.GameStates.G_Inplay extends Base.GameState
{
var _gameContext, _levelPrompt, _currentLevelFrame, _step, startScreenTransition;
function G_Inplay () {
super();
}
function Entry(gameContext) {
_gameContext = gameContext;
if (gameContext.getGameData().getNumPlayers() == 0) {
gameContext.getGameData().addPlayer();
}
gameContext.getGameData().initBoard(1);
gameContext.getGameData().setGameOver(false);
_levelPrompt = new Base.SpriteEntity(gameContext, 1, 1, "LVL_PROMPT", "LVL_PROMPT", 20000, 0, 0, -1, -1, -1);
_currentLevelFrame = 1;
_step = showLevelPrompt;
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_LEVEL_START);
}
function Update(gameContext) {
_step();
_gameContext.getGameData().updateParticles();
if (gameContext.getGameData().isGameOver()) {
gameContext.getGameManager().setNextState(Game.GameStates.G_GameOver);
}
}
function Exit(gameContext) {
startScreenTransition(gameContext, "SCRN_Trans", 1, 10, 30, 20000);
}
function showLevelPrompt() {
_currentLevelFrame++;
if ((_currentLevelFrame >= 20) && (_currentLevelFrame <= 79)) {
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "It\u2019s a Jungle Out There";
}
if (_currentLevelFrame == 50) {
_gameContext.getGameData().createParticlesForLevelIntro();
}
_levelPrompt.moveToFrame(_currentLevelFrame);
if (_currentLevelFrame == 100) {
_step = playGame;
}
}
function playGame() {
var _local2 = 0;
while (_local2 < _gameContext.getGameData().getNumPlayers()) {
_gameContext.getGameData().getPlayer(_local2).Update();
_local2++;
}
}
}
Symbol 168 MovieClip [__Packages.Game.GameStates.G_GameOver] Frame 0
class Game.GameStates.G_GameOver extends Base.GameState
{
var startScreenTransition, _mouseOverButton;
function G_GameOver () {
super();
}
function Entry(gameContext) {
gameContext.getGameData().removeBoard();
gameContext.getUIManager().showScreen(gameContext.getGameData().getScreen(2));
startScreenTransition(gameContext, "SCRN_Trans", 10, 1, 30, 20000);
gameContext.getUIManager().getScreen().getMovieClip().winScore.text = gameContext.getGameData().getScore();
gameContext.getUIManager().getScreen().getMovieClip().winCombo.text = gameContext.getGameData().getMaxCombo();
gameContext.getGameData()._tracker.sendEventWin();
}
function Update(gameContext) {
if (gameContext.getUIManager().getScreen().isMouseOverChild("btn_playAgain")) {
if (!_mouseOverButton) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_OVER);
_mouseOverButton = true;
}
} else {
_mouseOverButton = false;
}
if (gameContext.getUIManager().getUIReturnVal() == 1) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_BUTTON_PRESS);
gameContext.getGameData()._tracker.sendEventReplay();
gameContext.getGameData().reInitGame();
gameContext.getGameManager().setNextState(Game.GameStates.G_Inplay);
}
}
function Exit(gameContext) {
}
}
Symbol 169 MovieClip [__Packages.Game.GameData] Frame 0
class Game.GameData
{
var _gameContext, _soundMC, _soundModule, _board, _clips, _players, _level, _score, _maxCombo, _gameOver, _particles, _boardNum, _cellSize, _numColors, _tracker, _gameX, _gameY, _posX, _posY, _gameBoard, _remainCols, _dColLeft, _dColRight, _cellsRemaining;
function GameData (gameContext) {
_gameContext = gameContext;
_global.MUSIC_MUTE = false;
_global.MUSIC_VOL = 100;
_soundMC = _root.createEmptyMovieClip("sound_mc", 12000);
_soundModule = new Base.SoundModule(_soundMC);
var _local4 = 0;
while (_local4 < _soundEventList.length) {
var _local5 = _soundModule.LoadSound(_soundEventList[_local4].linkageName);
_local5.attachSound(_soundEventList[_local4].linkageName);
_local4++;
}
_board = new Array();
_clips = new Array();
_clips = [];
_players = [];
_level = 1;
_score = 0;
_maxCombo = 0;
_gameOver = false;
_particles = new Array();
}
function getScreen(num) {
return(_screens[num]);
}
function getBoardWidth() {
return(_boardWidth[_boardNum]);
}
function getBoardHeight() {
return(_boardHeight[_boardNum]);
}
function getScore() {
return(_score);
}
function getMaxCombo() {
return(_maxCombo);
}
function setLevel(level) {
_level = level;
}
function getLevel() {
return(_level);
}
function setCellSize(size) {
_cellSize = size;
}
function getCellSize() {
return(_cellSize);
}
function setNumColors(num) {
_numColors = num;
}
function getNumColors() {
return(_numColors);
}
function addPlayer() {
_players.push(new Base.Entity(_gameContext, 1, 1, false, false, Game.AIStates.AI_WaitToPick));
}
function getNumPlayers() {
return(_players.length);
}
function getPlayer(idx) {
return(_players[idx]);
}
function resetMaxCombo() {
_maxCombo = 0;
}
function setGameOver(toSet) {
_gameOver = toSet;
}
function isGameOver() {
return(_gameOver);
}
function reInitGame() {
_level = 1;
_maxCombo = 0;
_gameOver = false;
delete _players;
_players = [];
_score = 0;
_particles = [];
_clips = [];
}
function toString(Void) {
return("GameData()");
}
function LoadTracking() {
_tracker = new Game.GameTrack_AS2(10000);
}
function fillBoard() {
var _local3;
var _local2;
_numColors = _boardNumColors[_level - 1];
_cellSize = _pieceSize[_boardNum];
_local3 = 0;
while (_local3 < _gameX) {
_board[_local3] = new Array();
_local2 = 0;
while (_local2 < _gameY) {
var _local4 = (_local3 * _gameY) + _local2;
var _local5 = Math.floor(Math.random() * _numColors);
var _local6 = _pieceLevel[_boardNum] + _pieceColors[_local5];
_clips.push(new Base.SpriteEntity(_gameContext, _local5, _local4, _local6, _local6 + _local4, 10000 + _local4, _posX + (_cellSize * _local3), _posY + (_cellSize * _local2), 2, -1, -1));
_clips[_clips.length - 1].x = _local3;
_clips[_clips.length - 1].y = _local2;
_clips[_clips.length - 1].toFade = false;
_board[_local3][_local2] = new Object();
_board[_local3][_local2].id = _local4;
_board[_local3][_local2].x = _local3;
_board[_local3][_local2].y = _local2;
_board[_local3][_local2].marked = false;
_board[_local3][_local2].type = _local5;
_local2++;
}
_local3++;
}
}
function killBoard() {
_gameBoard.removeSprite();
delete _gameBoard;
_board = [];
var _local3 = _clips.length - 1;
var _local2 = _local3;
while (_local2 >= 0) {
_clips[_local2].removeSprite();
_clips.splice(_local2, 1);
_local2--;
}
_clips = [];
}
function initBoard() {
_boardNum = Math.floor((_level - 1) / 5);
_gameX = _boardWidth[_boardNum];
_gameY = _boardHeight[_boardNum];
_posX = _boardOffsetX[_boardNum];
_posY = _boardOffsetY[_boardNum];
_remainCols = _gameX - 1;
_dColLeft = 0;
_dColRight = 0;
var _local6 = _gameX;
var _local5 = _gameY;
var _local4 = _gameX;
var _local3 = _gameY;
var _local2 = _boardName[Math.floor((_level - 1) / 5)];
_gameBoard = new Base.SpriteEntity(_gameContext, 1, 1, _local2, "board" + _level, 1000, 0, 0, 0, -1, -1);
_gameBoard.getMovieClip().gui.gotoAndStop(_boardNum + 1);
_gameBoard.getMovieClip().gui.boardLevel.text = "Level " + _level;
_gameBoard.getMovieClip().gui.score.text = _score;
_cellsRemaining = _local4 * _local3;
fillBoard();
}
function removeBoard() {
_gameBoard.removeSprite();
delete _gameBoard;
}
function clearPiece(x, y) {
var _local2 = _board[x][y].id;
if (_local2 < 0) {
return(false);
}
playSoundByEvent(SND_DEDUCT_POINTS);
_score = _score - 10;
_clips[_local2].changeSprite("ReductionTally", "ReductionTally");
_gameBoard.getMovieClip().gui.score.text = _score;
return(true);
}
function clearPieces() {
var _local3 = _clips.length - 1;
var _local2 = _local3;
while (_local2 >= 0) {
_score = _score - 10;
_clips[_local2].removeSprite();
_clips.splice(_local2, 1);
_gameBoard.getMovieClip().gui.score.text = _score;
_local2--;
}
}
function updateScore(numHighlighted) {
_score = _score + ((10 * numHighlighted) * numHighlighted);
_gameBoard.getMovieClip().gui.score.text = _score;
if (numHighlighted > _maxCombo) {
_maxCombo = numHighlighted;
}
}
function markPiece(x, y) {
_board[x][y].marked = true;
}
function isMarked(x, y) {
return(_board[x][y].marked == true);
}
function removePiece(x, y) {
_board[x][y].type = -1;
}
function isOfType(x, y, type) {
if (type == -1) {
return(false);
}
if ((((x >= _gameX) || (x < 0)) || (y >= _gameY)) || (y < 0)) {
return(false);
}
if (_board[x][y].type == type) {
return(true);
}
return(false);
}
function isBlankSpace(x, y) {
return(_board[x][y].id == -1);
}
function markPieces(x, y, type) {
var _local5 = 1;
if (isMarked(x, y)) {
return(0);
}
markPiece(x, y);
if (isOfType(x, y + 1, type)) {
_local5 = _local5 + markPieces(x, y + 1, type);
}
if (isOfType(x, y - 1, type)) {
_local5 = _local5 + markPieces(x, y - 1, type);
}
if (isOfType(x + 1, y, type)) {
_local5 = _local5 + markPieces(x + 1, y, type);
}
if (isOfType(x - 1, y, type)) {
_local5 = _local5 + markPieces(x - 1, y, type);
}
return(_local5);
}
function isValidMoveLeft() {
var _local4 = false;
var _local3 = 0;
while (_local3 < _gameX) {
var _local2 = 0;
while (_local2 < _gameY) {
if (markPieces(_local3, _local2, _board[_local3][_local2].type) >= 2) {
_local4 = true;
break;
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _gameX) {
var _local2 = 0;
while (_local2 < _gameY) {
_board[_local3][_local2].marked = false;
_local2++;
}
_local3++;
}
return(_local4);
}
function putClipOnTop() {
var _local2 = 0;
while (_local2 < _clips.length) {
var _local5 = _clips[_local2].x;
var _local4 = _clips[_local2].y;
if (_board[_local5][_local4].marked == true) {
var _local3 = _clips[_local2].getZDepth();
_clips[_local2].setZDepth(_local3 + 100000);
}
_local2++;
}
_local2 = 0;
while (_local2 < _clips.length) {
var _local5 = _clips[_local2].x;
var _local4 = _clips[_local2].y;
_local2++;
}
}
function fade(fadeVal) {
var _local2 = 0;
while (_local2 < _clips.length) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
if (_board[_local4][_local3].marked == true) {
if (_clips[_local2].getType() != _board[_clips[_local2].x][_clips[_local2].y].type) {
} else {
_clips[_local2].moveToFrame(fadeVal);
}
}
_local2++;
}
if (fadeVal >= 36) {
_local2 = _clips.length - 1;
while (_local2 >= 0) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
if (_board[_local4][_local3].marked == true) {
_clips[_local2].getMovieClip()._alpha = 0;
_board[_local4][_local3].type = -1;
}
_local2--;
}
}
}
function createParticles() {
var _local5 = _gameContext.getGameData().SND_LEAF_PARTICLE;
switch (_boardNum) {
case 0 :
_local5 = _gameContext.getGameData().SND_LEAF_PARTICLE;
break;
case 1 :
_local5 = _gameContext.getGameData().SND_WATER_PARTICLE;
break;
case 2 :
_local5 = _gameContext.getGameData().SND_FIRE_PARTICLE;
}
_gameContext.getGameData().playSoundByEvent(_local5);
var _local2 = 0;
while (_local2 < _clips.length) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
if (_board[_local4][_local3].marked == true) {
if (_clips[_local2].getMovieClip()._alpha == 0) {
} else if (_clips[_local2].getType() != _board[_local4][_local3].type) {
} else {
createParticle(_clips[_local2].getPositionX(), _clips[_local2].getPositionY());
}
}
_local2++;
}
}
function createParticlesForLevelIntro() {
if (_particles.length > 0) {
return(undefined);
}
var _local5 = _gameContext.getGameData().SND_LEAF_PARTICLE;
switch (_boardNum) {
case 0 :
_local5 = _gameContext.getGameData().SND_LEAF_PARTICLE;
break;
case 1 :
_local5 = _gameContext.getGameData().SND_WATER_PARTICLE;
break;
case 2 :
_local5 = _gameContext.getGameData().SND_FIRE_PARTICLE;
}
var _local2 = 0;
while (_local2 < 80) {
var _local4 = Math.random() * 600;
var _local3 = Math.random() * 400;
createParticle(_local4, _local3);
_local2++;
}
}
function createParticle(x, y) {
var _local2 = _particles.length;
var _local7 = x + (_cellSize / 2);
var _local6 = (y + (_cellSize / 2)) + (random(30) - 20);
_particles.push(new Base.SpriteEntity(_gameContext, 1, 1, _particleName[_boardNum], _particleName[_boardNum] + _particleDepth, 100000 + _particleDepth, _local7, _local6, 2, -1, -1));
_particleDepth++;
if (_particleDepth > 400) {
_particleDepth = 1;
}
var _local3;
var _local5;
var _local4;
switch (_boardNum) {
case 0 :
_local3 = random(70) + 30;
_local5 = random(20) - 10;
_local4 = 15 + (Math.random() * 15);
break;
case 1 :
_local3 = random(70) + 30;
_local5 = random(20) - 10;
_local4 = 30;
break;
case 2 :
_local3 = random(100) + 50;
_local4 = 30;
}
_particles[_local2].getMovieClip()._xscale = _local3;
_particles[_local2].getMovieClip()._yscale = _local3;
if (_boardNum != 2) {
_particles[_local2].getMovieClip()._rotation = _local5;
}
var _local8 = random(2);
if (_local8 == 1) {
_particles[_local2].getMovieClip()._xscale = -_local3;
}
_particles[_local2].startAnimating(1, 30, _local4, false);
}
function updateParticles() {
var _local3 = _particles.length - 1;
if (_local3 < 0) {
return(undefined);
}
var _local2 = _local3;
while (_local2 >= 0) {
_particles[_local2].animateSprite();
if (!_particles[_local2].isAnimating()) {
_particles[_local2].removeSprite();
_particles.splice(_local2, 1);
}
_local2--;
}
}
function drop() {
var _local4 = 0;
var _local3 = 0;
while (_local3 < _gameX) {
var _local2 = _gameY - 2;
while (_local2 >= 0) {
if (isMarked(_local3, _local2)) {
} else if (isMarked(_local3, _local2 + 1)) {
_clips[_board[_local3][_local2].id].y = _clips[_board[_local3][_local2].id].y + 1;
_clips[_board[_local3][_local2].id].adjustPositionY(_cellSize);
_board[_local3][_local2 + 1].id = _board[_local3][_local2].id;
_board[_local3][_local2 + 1].type = _board[_local3][_local2].type;
_board[_local3][_local2].id = -1;
_board[_local3][_local2].type = -1;
_board[_local3][_local2 + 1].x = _board[_local3][_local2].x;
_board[_local3][_local2 + 1].y = _board[_local3][_local2].y;
_board[_local3][_local2 + 1].marked = false;
_board[_local3][_local2].marked = true;
_local4++;
}
_local2--;
}
_local3++;
}
return(_local4);
}
function columnIsEmpty(col) {
var _local2 = 0;
while (_local2 < _gameY) {
if (_board[col][_local2].type != -1) {
return(false);
}
_local2++;
}
return(true);
}
function isBoardEmpty() {
var _local2 = 0;
while (_local2 < _gameX) {
if (!columnIsEmpty(_local2)) {
return(false);
}
_local2++;
}
return(true);
}
function slide() {
var _local2 = 0;
_local2 = _local2 + slideRCols();
_local2 = _local2 + slideLCols();
return(_local2);
}
function slideRCols() {
var _local4 = 0;
var _local3 = Math.floor(_gameX / 2) - 2;
while (_local3 >= 0) {
if ((!columnIsEmpty(_local3)) && (columnIsEmpty(_local3 + 1))) {
var _local2 = 0;
while (_local2 < _gameY) {
_clips[_board[_local3][_local2].id].x = _clips[_board[_local3][_local2].id].x + 1;
_clips[_board[_local3][_local2].id].adjustPositionX(_cellSize);
_board[_local3 + 1][_local2].id = _board[_local3][_local2].id;
_board[_local3 + 1][_local2].type = _board[_local3][_local2].type;
_board[_local3][_local2].id = -1;
_board[_local3][_local2].type = -1;
_board[_local3 + 1][_local2].x = _board[_local3][_local2].x;
_board[_local3 + 1][_local2].y = _board[_local3][_local2].y;
_local2++;
}
_local4++;
}
_local3--;
}
return(_local4);
}
function slideLCols() {
var _local4 = 0;
var _local3 = Math.floor(_gameX / 2) + 1;
while (_local3 < _gameX) {
if ((!columnIsEmpty(_local3)) && (columnIsEmpty(_local3 - 1))) {
var _local2 = 0;
while (_local2 < _gameY) {
_clips[_board[_local3][_local2].id].x = _clips[_board[_local3][_local2].id].x - 1;
_clips[_board[_local3][_local2].id].adjustPositionX(-_cellSize);
_board[_local3 - 1][_local2].id = _board[_local3][_local2].id;
_board[_local3 - 1][_local2].type = _board[_local3][_local2].type;
_board[_local3][_local2].id = -1;
_board[_local3][_local2].type = -1;
_board[_local3 - 1][_local2].x = _board[_local3][_local2].x;
_board[_local3 - 1][_local2].y = _board[_local3][_local2].y;
_local2++;
}
_local4++;
}
_local3++;
}
return(_local4);
}
function highlightLargestGroup() {
var _local7 = 0;
var _local9 = 0;
var _local8 = 0;
var _local2 = 0;
while (_local2 < _clips.length) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
var _local6 = _board[_local4][_local3].type;
clearMarked();
var _local5 = markPieces(_local4, _local3, _local6);
if (_local5 > _local7) {
_local7 = _local5;
_local9 = _local4;
_local8 = _local3;
}
_local2++;
}
clearMarked();
markPieces(_local9, _local8, _board[_local9][_local8].type);
highlightGroup();
}
function markGroup() {
var _local7 = 0;
var _local5 = -1;
var _local4 = -1;
var _local3 = 0;
while (_local3 < _gameX) {
var _local2 = 0;
while (_local2 < _gameY) {
_board[_local3][_local2].marked = false;
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _clips.length) {
if (_clips[_local3].isMouseOver()) {
_local5 = _clips[_local3].x;
_local4 = _clips[_local3].y;
var _local6 = _board[_local5][_local4].type;
_local7 = markPieces(_local5, _local4, _local6);
break;
}
_local3++;
}
if (_local7 >= 2) {
if (((_lastMarkedX < 0) && (_lastMarkedY < 0)) || (_board[_lastMarkedX][_lastMarkedY].marked == false)) {
_lastMarkedX = _local5;
_lastMarkedY = _local4;
playSoundByEvent(SND_GROUP_HIGHLIGHTED);
}
}
return(_local7);
}
function highlightGroup() {
var _local2 = 0;
while (_local2 < _clips.length) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
if (_board[_local4][_local3].marked == true) {
_clips[_local2].moveToFrame(10);
} else {
_clips[_local2].moveToFrame(1);
}
_local2++;
}
}
function clearMarked() {
var _local2 = 0;
while (_local2 < _clips.length) {
var _local4 = _clips[_local2].x;
var _local3 = _clips[_local2].y;
_board[_local4][_local3].marked = false;
_clips[_local2].moveToFrame(1);
_local2++;
}
}
function checkForMarked() {
var _local3 = 0;
while (_local3 < _gameX) {
var _local2 = 0;
while (_local2 < _gameY) {
if (isMarked(_local3, _local2) && (!isBlankSpace(_local3, _local2))) {
}
_local2++;
}
_local3++;
}
}
function setupBoard() {
_clips = [];
var _local3 = 0;
while (_local3 < _gameX) {
var _local2 = 0;
while (_local2 < _gameY) {
if (_board[_local3][_local2].type == -1) {
} else {
var _local5 = _board[_local3][_local2].type;
var _local4 = (_local3 * _gameX) + _local2;
_clips.push(new Base.SpriteEntity(_gameContext, _local5, _local4, "cell", "cell" + _local4, _local4, _posX + (_cellSize * _local3), _posY + (_cellSize * _local2), 2, -1, -1));
_clips[_clips.length - 1].moveToFrame(_local5 + 2);
_clips[_clips.length - 1].x = _local3;
_clips[_clips.length - 1].y = _local2;
_clips[_clips.length - 1].toFade = false;
}
_local2++;
}
_local3++;
}
}
function isRowEmpty() {
var _local4 = true;
var _local5 = true;
var _local3 = 0;
while (_local3 < _gameX) {
_local5 = _local4;
_local4 = true;
var _local2 = 0;
while (_local2 < _gameY) {
if (_board[_local3][_local2].type != -1) {
_local4 = false;
break;
}
_local2++;
}
if ((_local4 == true) && (_local5 == false)) {
return(true);
}
_local3++;
}
}
function shuffleBoard() {
var _local6 = _clips.length;
playSoundByEvent(SND_SHUFFLE_TILES);
var _local3 = 0;
while (_local3 < _local6) {
if (_clips[_local3].getMovieClip()._alpha == 0) {
} else if (_board[_clips[_local3].x][_clips[_local3].y].type == -1) {
} else {
var _local2 = Math.floor(Math.random() * _local6);
while ((_clips[_local2].getMovieClip()._alpha == 0) || (_board[_clips[_local2].x][_clips[_local2].y].type == -1)) {
_local2 = Math.floor(Math.random() * _local6);
}
var _local5 = _clips[_local3].x;
var _local4 = _clips[_local3].y;
var _local8 = _board[_local5][_local4].id;
var _local7 = _board[_local5][_local4].type;
var _local9 = _clips[_local3].getPositionX();
var _local10 = _clips[_local3].getPositionY();
_clips[_local3].setPositionX(_clips[_local2].getPositionX());
_clips[_local3].setPositionY(_clips[_local2].getPositionY());
_clips[_local3].setID(_clips[_local2].getID());
_clips[_local3].setType(_clips[_local2].getType());
_board[_local5][_local4].id = _board[_clips[_local2].x][_clips[_local2].y].id;
_board[_local5][_local4].type = _board[_clips[_local2].x][_clips[_local2].y].type;
_clips[_local3].x = _clips[_local2].x;
_clips[_local3].y = _clips[_local2].y;
_board[_clips[_local2].x][_clips[_local2].y].id = _local8;
_board[_clips[_local2].x][_clips[_local2].y].type = _local7;
_clips[_local2].x = _local5;
_clips[_local2].y = _local4;
_clips[_local2].setPositionX(_local9);
_clips[_local2].setPositionY(_local10);
_clips[_local2].setType(_local7);
}
_local3++;
}
}
function playSound(event) {
var _local2 = 0;
while (_local2 < _soundEventList.length) {
if (_soundEventList[_local2].eventName == event) {
_soundModule.PlaySound(_soundEventList[_local2].linkageName, _soundEventList[_local2].volume, _soundEventList[_local2].pan, _soundEventList[_local2].offset, _soundEventList[_local2].loop, _soundEventList[_local2].force);
return(undefined);
}
_local2++;
}
}
function playSoundByEvent(event) {
playSound(event);
}
var _boardName = new Array("Board_1thru5", "Board_6thru10", "Board_11thru15");
var _boardWidth = new Array(14, 18, 28);
var _boardHeight = new Array(8, 10, 16);
var _boardOffsetX = new Array(20, 30, 20);
var _boardOffsetY = new Array(60, 70, 60);
var _boardNumColors = new Array(3, 3, 3, 4, 4, 3, 3, 4, 4, 4, 3, 3, 4, 4, 4);
var _pieceColors = new Array("Red", "Yellow", "Green", "Blue", "Purple");
var _pieceLevel = new Array("A_block", "B_block", "C_block");
var _pieceSize = new Array(40, 30, 20);
var _particleName = new Array("Particle_Leaf", "Particle_Water", "Particle_Fire");
var _screens = [{id:6, idx:1, spriteName:"Screen_Titlecard", clipName:"Titlecard_mc", depth:10, xPos:0, yPos:0, regPt:2, w:-1, h:-1, children:[["btn_start", 10, 16, 130, 84, 1, 2, 60, false, 129, 1]]}, {id:6, idx:1, spriteName:"Screen_Instructions", clipName:"Titlecard_mc", depth:10, xPos:0, yPos:0, regPt:2, w:-1, h:-1, children:[["btn_play", 10, 16, 130, 84, 1, 2, 60, false, 129, 1]]}, {id:6, idx:1, spriteName:"Screen_Win", clipName:"Screen_Win", depth:10, xPos:0, yPos:0, regPt:2, w:-1, h:-1, children:[["btn_playAgain", 10, 16, 250, 90, 1, 2, 60, false, 129, 1]]}];
var SND_BUTTON_OVER = 0;
var SND_BUTTON_PRESS = 1;
var SND_GROUP_HIGHLIGHTED = 2;
var SND_GROUP_PICKED = 3;
var SND_HIGHLIGHT_LARGEST = 4;
var SND_DEDUCT_POINTS = 5;
var SND_LEAF_PARTICLE = 6;
var SND_WATER_PARTICLE = 7;
var SND_FIRE_PARTICLE = 8;
var SND_LEVEL_START = 9;
var SND_BOARD_CLEARED = 10;
var SND_OUT_OF_MOVES = 11;
var SND_SHUFFLE_TILES = 12;
var _soundEventList = [{eventName:Game.GameData.prototype.SND_BUTTON_OVER, linkageName:"buttonOver", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_BUTTON_PRESS, linkageName:"buttonPress", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_GROUP_HIGHLIGHTED, linkageName:"groupHighlighted", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_GROUP_PICKED, linkageName:"groupPicked", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_HIGHLIGHT_LARGEST, linkageName:"highlightLargest", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_DEDUCT_POINTS, linkageName:"deductPoints", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_LEAF_PARTICLE, linkageName:"leafParticle", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_WATER_PARTICLE, linkageName:"waterParticle", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_FIRE_PARTICLE, linkageName:"fireParticle", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_LEVEL_START, linkageName:"levelStart", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_BOARD_CLEARED, linkageName:"boardCleared", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_SHUFFLE_TILES, linkageName:"shuffleTiles", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:Game.GameData.prototype.SND_OUT_OF_MOVES, linkageName:"outOfMoves", volume:100, pan:0, offset:0, loop:false, force:false}];
var _particleDepth = 1;
var _lastMarkedX = -1;
var _lastMarkedY = -1;
}
Symbol 170 MovieClip [__Packages.Base.SoundModule] Frame 0
class Base.SoundModule
{
var _mc, _hash, _num, _active_sounds, _fade_interval, _music_mute, _defaultVol, _musicOff, _curr_music, _fade_interval2;
function SoundModule (mc) {
_mc = mc;
_hash = {};
_num = 0;
_active_sounds = [];
_fade_interval = null;
_music_mute = _global.MUSIC_MUTE;
_defaultVol = 150;
_musicOff = false;
}
function SoundAvailable() {
return(_active_sounds.length < 16);
}
function LoadSound(sound_name) {
_num++;
var _local3 = "mySound" + _num;
_mc.createEmptyMovieClip(_local3, _num);
var _local2 = new Sound(_mc[_local3]);
_local2.parent = this;
_local2.lastStart = 0;
_local2.onSoundComplete = function () {
this.parent.DeactivateSound(sound_name);
};
_hash[sound_name] = _local2;
return(_local2);
}
function createSoundInstance(sound_instance, ownerID) {
var snd_Name = ((sound_instance + "_") + ownerID);
_num++;
var _local3 = "mySound" + _num;
_mc.createEmptyMovieClip(_local3, _num);
var _local2 = new Sound(_mc[_local3]);
_local2.parent = this;
_local2.lastStart = 0;
_local2.onSoundComplete = function () {
this.parent.DeactivateSound(snd_Name);
};
_hash[snd_Name] = _local2;
_local2.attachSound(sound_instance);
return(snd_Name);
}
function SetMusicMute(oBool) {
_music_mute = oBool;
if (_music_mute == true) {
StopMusic();
} else {
PlayMusic(_curr_music);
}
}
function GetMusicMute() {
return(_music_mute);
}
function StopMusic() {
var _local2 = _active_sounds.length;
while (_local2--) {
if (_active_sounds[_local2].indexOf("music") != -1) {
StopSound(_active_sounds[_local2]);
break;
}
}
_curr_music = "none";
}
function StopAllSounds() {
var _local2 = _active_sounds.length;
while (_local2--) {
if (_active_sounds[_local2].indexOf("music") == -1) {
StopSound(_active_sounds[_local2]);
}
}
}
function isPlayingPrefix(str) {
var _local2 = _active_sounds.length;
while (_local2--) {
if (_active_sounds[_local2].indexOf(str) != -1) {
return(true);
}
}
return(false);
}
function AdjustMusicVolume(vol) {
if (_curr_music == "none") {
return(undefined);
}
var _local2 = "music_" + _curr_music;
_hash[_local2].setVolume(vol);
}
function GetCurMusic(Void) {
return(_curr_music);
}
function getMusicOff() {
return(_musicOff);
}
function setMusicOff(toSet) {
_musicOff = toSet;
}
function PlayMusic(str, useCurrentVolume) {
if (_musicOff) {
return(undefined);
}
if (str == _curr_music) {
return(undefined);
}
if (str == "none") {
FadeSound("music_" + _curr_music, _global.MUSIC_VOL, 0, 0.5);
} else {
CrossFade("music_" + _curr_music, "music_" + str, 0.5, useCurrentVolume);
_curr_music = str;
}
}
function DeactivateSound(snd) {
var _local2 = _active_sounds.length;
while (_local2--) {
if (snd == _active_sounds[_local2]) {
_active_sounds.splice(_local2, 1);
break;
}
}
}
function DeactivateAllSounds() {
_active_sounds = [];
}
function StopSound(snd) {
var _local2 = _hash[snd];
_local2.stop();
DeactivateSound(snd);
}
function soundIsPlaying(snd) {
for (var _local2 in _active_sounds) {
if (_active_sounds[_local2] == snd) {
return(true);
}
}
return(false);
}
function PlaySound(snd, vol, pan, offset, loop, force) {
if ((snd.indexOf("music") != -1) && (_music_mute == true)) {
return(undefined);
}
for (var _local3 in _active_sounds) {
if (_active_sounds[_local3] == snd) {
if (((snd != "sectionComplete") && (snd != "btn1")) && (snd != "sectionLightup")) {
if (force == undefined) {
return(undefined);
}
}
}
}
if (SoundAvailable()) {
var _local4 = _hash[snd];
if (vol == null) {
_local4.setVolume(_defaultVol);
} else {
_local4.setVolume(vol);
}
if (pan != null) {
_local4.setPan(pan);
}
if (offset == null) {
offset = 0;
}
if (loop == null) {
loop = 0;
}
_local4.start(offset, loop);
_active_sounds.push(snd);
}
}
function CrossFade(snd1, snd2, dur, useCurrentVolume) {
var _local3 = _global.MUSIC_VOL;
if (useCurrentVolume != undefined) {
_local3 = _hash[snd1].getVolume();
}
FadeSound(snd1, _local3, 0, dur);
PlaySound(snd2, 0, 0, 0, 9999);
FadeSound2(snd2, 0, _local3, dur);
}
function FadeSound(snd, startVol, endVol, duration) {
if (_fade_interval != null) {
clearInterval(_fade_interval);
}
_hash[snd].setVolume(startVol);
var _local2 = 1;
if (endVol < startVol) {
_local2 = -1;
}
var _local5 = (duration / Math.abs(endVol - startVol)) * 1000;
_fade_interval = setInterval(this, "Fade_Sound_Update", _local5, [snd, endVol, _local2]);
}
function FadeSound2(snd, startVol, endVol, duration) {
if (_fade_interval2 != null) {
clearInterval(_fade_interval2);
}
_hash[snd].setVolume(startVol);
var _local2 = 1;
if (endVol < startVol) {
_local2 = -1;
}
var _local5 = (duration / Math.abs(endVol - startVol)) * 1000;
_fade_interval2 = setInterval(this, "Fade_Sound_Update2", _local5, [snd, endVol, _local2]);
}
function Fade_Sound_Update(sndAr) {
var _local3 = sndAr[0];
var _local5 = sndAr[1];
var _local4 = sndAr[2];
var _local2 = _hash[_local3].getVolume() + _local4;
if (((_local4 > 0) && (_local2 <= _local5)) || ((_local4 < 0) && (_local2 >= _local5))) {
_hash[_local3].setVolume(_local2);
if (_local2 <= 0) {
StopSound(_local3);
}
} else {
clearInterval(_fade_interval);
}
}
function Fade_Sound_Update2(sndAr) {
var _local3 = sndAr[0];
var _local5 = sndAr[1];
var _local4 = sndAr[2];
var _local2 = _hash[_local3].getVolume() + _local4;
if (((_local4 > 0) && (_local2 <= _local5)) || ((_local4 < 0) && (_local2 >= _local5))) {
_hash[_local3].setVolume(_local2);
if (_local2 <= 0) {
StopSound(_local3);
}
} else {
clearInterval(_fade_interval2);
}
}
function getSound(snd) {
return(_hash[snd]);
}
function toString() {
return("SoundModule()");
}
function unload() {
for (var _local3 in _hash) {
delete _hash[_local3];
}
var _local2 = 0;
while (_local2 < _num) {
_mc["mySound" + _num].removeMovieClip();
_local2++;
}
delete _hash;
}
static var MAX_SOUNDS = 16;
}
Symbol 171 MovieClip [__Packages.Game.GameTrack_AS2] Frame 0
class Game.GameTrack_AS2
{
var trkConnection;
function GameTrack_AS2 (level) {
trkConnection = new LocalConnection();
loadMovieNum ("tracker.swf", level);
}
function sendEventReplay() {
trackNewEvent("replay");
}
function sendEventWin() {
trackNewEvent("win");
}
function sendEventLose() {
trackNewEvent("lose");
}
function sendEventCustom(event) {
trackNewEvent("cust_" + event);
}
function trackNewEvent(eventName) {
trkConnection.send("trkConnection", "sendTracking", eventName);
}
}
Symbol 172 MovieClip [__Packages.Base.Entity] Frame 0
class Base.Entity
{
var _gameContext, _currentAIState, _nextAIState, _id, _type, _cpuControlled, _networkControlled, _moveSpeed, _destPosX, _destPosY, _startingPositionX, _startingPositionY, _followingAIState;
function Entity (gameContext, entType, id, cpuControlled, networkControlled, state) {
_gameContext = gameContext;
_currentAIState = null;
_nextAIState = new state[undefined](this);
_id = id;
_type = entType;
}
function getID() {
return(_id);
}
function getType(Void) {
return(_type);
}
function isCPUControlled() {
return(_cpuControlled);
}
function isNetworkControlled() {
return(_networkControlled);
}
function setMoveSpeed(speed) {
_moveSpeed = speed;
}
function setDestPosX(pos) {
_destPosX = pos;
}
function setDestPosY(pos) {
_destPosY = pos;
}
function setStartingPositionToPosition() {
_startingPositionX = 0;
_startingPositionY = 0;
}
function getMoveSpeed() {
return(_moveSpeed);
}
function getDestPosX() {
return(_destPosX);
}
function getDestPosY() {
return(_destPosY);
}
function getStartingPositionX() {
return(_startingPositionX);
}
function getStartingPositionY() {
return(_startingPositionY);
}
function isAtDestination() {
return(true);
}
function setNextState(state) {
_nextAIState = new state[undefined](this);
}
function setFollowingState(state) {
_followingAIState = state;
}
function getFollowingState() {
return(_followingAIState);
}
function Update() {
if (_currentAIState != _nextAIState) {
_currentAIState = _nextAIState;
_currentAIState.Entry(_gameContext);
} else if (_currentAIState == _nextAIState) {
_currentAIState.PadInput(_gameContext);
_currentAIState.Update(_gameContext);
if (_currentAIState != _nextAIState) {
_currentAIState.Exit(_gameContext);
delete _currentAIState;
if (!_nextAIState) {
return(1);
}
}
}
return(0);
}
function toString(Void) {
return("Entity()");
}
}
Symbol 173 MovieClip [__Packages.Base.AIState] Frame 0
class Base.AIState extends Base.State
{
function AIState () {
super();
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 174 MovieClip [__Packages.Game.AIStates.AI_WaitToPick] Frame 0
class Game.AIStates.AI_WaitToPick extends Base.AIState
{
var _entity, _groupPicked, _timeWithoutMakingMove, _highlightingLargest;
function AI_WaitToPick (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_groupPicked = false;
_timeWithoutMakingMove = TIME_BEFORE_HIGHLIGHTING;
_timeHighlightingBestMove = 0;
_highlightingLargest = false;
}
function PadInput(gameContext) {
gameContext.getGameData().clearMarked();
var _local3 = gameContext.getGameData().markGroup();
if (_local3 > 1) {
gameContext.getGameData().highlightGroup();
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().updateScore(_local3);
_groupPicked = true;
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_GROUP_PICKED);
}
}
}
function Update(gameContext) {
if (_groupPicked) {
_groupPicked = false;
_entity.setNextState(Game.AIStates.AI_Fade);
} else {
if (gameContext.getPadManager().getShiftDown()) {
if (gameContext.getPadManager().getCurrentKeyAction() == "l") {
_entity.setNextState(Game.AIStates.AI_BoardCleared);
}
if ((gameContext.getPadManager().getCurrentKeyAction() == "m") || (gameContext.getPadManager().getCurrentKeyActionHeld() == "m")) {
gameContext.getGameData().highlightLargestGroup();
if (!_highlightingLargest) {
gameContext.getGameData().playSoundByEvent(gameContext.getGameData().SND_HIGHLIGHT_LARGEST);
_highlightingLargest = true;
}
return(undefined);
}
_highlightingLargest = false;
if (gameContext.getPadManager().getCurrentKeyAction() == "s") {
gameContext.getGameData().shuffleBoard();
}
}
if (_timeWithoutMakingMove > 0) {
_timeWithoutMakingMove = _timeWithoutMakingMove - gameContext.getDT();
if (_timeWithoutMakingMove <= 0) {
_timeHighlightingBestMove = TIME_TO_HIGHLIGHT;
}
}
}
}
var _timeHighlightingBestMove = 0;
var TIME_BEFORE_HIGHLIGHTING = 10;
var TIME_TO_HIGHLIGHT = 0.5;
}
Symbol 175 MovieClip [__Packages.Game.AIStates.AI_Fade] Frame 0
class Game.AIStates.AI_Fade
{
var _entity, _fadeSpeed, _fadeVal;
function AI_Fade (entity) {
_entity = entity;
}
function Entry(gameContext) {
_fadeSpeed = 12;
_fadeVal = 20;
gameContext.getGameData().putClipOnTop();
gameContext.getGameData().createParticles();
}
function Update(gameContext) {
_fadeVal++;
gameContext.getGameData().fade(_fadeVal);
if (_fadeVal >= 36) {
_entity.setNextState(Game.AIStates.AI_Drop);
}
}
}
Symbol 176 MovieClip [__Packages.Game.AIStates.AI_Drop] Frame 0
class Game.AIStates.AI_Drop extends Base.AIState
{
var _entity;
function AI_Drop (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
}
function Update(gameContext) {
if (!gameContext.getGameData().drop()) {
_entity.setNextState(Game.AIStates.AI_Slide);
}
}
}
Symbol 177 MovieClip [__Packages.Game.AIStates.AI_Slide] Frame 0
class Game.AIStates.AI_Slide extends Base.AIState
{
var _entity;
function AI_Slide (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
}
function Update(gameContext) {
if (gameContext.getGameData().isBoardEmpty()) {
_entity.setNextState(Game.AIStates.AI_BoardCleared);
return(undefined);
}
if (!gameContext.getGameData().slide()) {
if (!gameContext.getGameData().isValidMoveLeft()) {
_entity.setNextState(Game.AIStates.AI_BoardCleared);
return(undefined);
}
_entity.setNextState(Game.AIStates.AI_WaitToPick);
}
}
function Exit(gameContext) {
gameContext.getGameData().isRowEmpty();
}
}
Symbol 178 MovieClip [__Packages.Game.AIStates.AI_BoardCleared] Frame 0
class Game.AIStates.AI_BoardCleared extends Base.AIState
{
var _entity, _gameContext, _levelPrompt, _currentLevelFrame, _holdTimer, _step, x, y, _timer;
function AI_BoardCleared (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_gameContext = gameContext;
_levelPrompt = new Base.SpriteEntity(gameContext, 1, 1, "LVL_PROMPT", "LVL_PROMPT", 20000, 0, 0, -1, -1, -1);
_currentLevelFrame = 1;
_holdTimer = 0;
_step = showLevelPrompt;
x = 0;
y = 0;
_timer = 0;
}
function Update(gameContext) {
_step();
}
function countPieces() {
_timer = _timer - _gameContext.getDT();
if (_timer <= 0) {
var _local2 = false;
while (!_local2) {
if (_gameContext.getGameData().clearPiece(x, y)) {
_local2 = true;
}
x++;
if (x >= _gameContext.getGameData().getBoardWidth()) {
y++;
if (y >= _gameContext.getGameData().getBoardHeight()) {
break;
}
x = 0;
}
}
_timer = 0.02;
}
if ((x >= _gameContext.getGameData().getBoardWidth()) && (y >= _gameContext.getGameData().getBoardHeight())) {
_holdTimer = 3;
_step = waitForNextLevel;
}
}
function waitForNextLevel() {
_holdTimer = _holdTimer - _gameContext.getDT();
if (_holdTimer <= 0) {
if (_gameContext.getGameData().getLevel() == 15) {
_gameContext.getGameData().setGameOver(true);
_step = nothing;
return(undefined);
}
_levelPrompt.changeSprite("SCRN_Trans", "SCRN_Trans");
_currentLevelFrame = 1;
_levelPrompt.moveToFrame(_currentLevelFrame);
_step = gotoBlack;
}
}
function showLevelPrompt() {
_currentLevelFrame++;
_levelPrompt.moveToFrame(_currentLevelFrame);
if ((_currentLevelFrame >= 20) && (_currentLevelFrame <= 79)) {
if (!_gameContext.getGameData().isBoardEmpty()) {
if (_currentLevelFrame == 20) {
_gameContext.getGameData().playSoundByEvent(_gameContext.getGameData().SND_OUT_OF_MOVES);
}
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "No Moves Left";
} else {
if (_currentLevelFrame == 20) {
_gameContext.getGameData().playSoundByEvent(_gameContext.getGameData().SND_BOARD_CLEARED);
}
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = " Perfect! All Blocks Cleared!";
}
}
if (_currentLevelFrame == 100) {
if (_gameContext.getGameData().isBoardEmpty() && (_gameContext.getGameData().getLevel() == 15)) {
_gameContext.getGameData().setGameOver(true);
_step = nothing;
return(undefined);
}
_levelPrompt.changeSprite("SCRN_Trans", "SCRN_Trans");
_currentLevelFrame = 1;
_levelPrompt.startAnimating(1, 10, 30, false);
if (!_gameContext.getGameData().isBoardEmpty()) {
_step = countPieces;
} else {
_holdTimer = 3;
_step = waitForNextLevel;
}
}
}
function nothing() {
}
function gotoBlack() {
_levelPrompt.animateSprite();
if (!_levelPrompt.isAnimating()) {
_gameContext.getGameData().setLevel(_gameContext.getGameData().getLevel() + 1);
_gameContext.getGameData().killBoard();
_gameContext.getGameData().initBoard();
_levelPrompt.startAnimating(10, 5, 30, false);
_step = goFromBlack;
}
}
function goFromBlack() {
_levelPrompt.animateSprite();
if (!_levelPrompt.isAnimating()) {
_currentLevelFrame = 1;
_levelPrompt.changeSprite("LVL_PROMPT", "LVL_PROMPT");
_levelPrompt.moveToFrame(_currentLevelFrame);
if (_gameContext.getGameData().getLevel() == 6) {
_gameContext.getGameData()._tracker.sendEventCustom("Level6");
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "Cabin Fever";
} else if (_gameContext.getGameData().getLevel() == 11) {
_gameContext.getGameData()._tracker.sendEventCustom("Level11");
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "What\u2019s Cookin\u2019?";
} else {
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "Level " + _gameContext.getGameData().getLevel();
}
_gameContext.getGameData().playSoundByEvent(_gameContext.getGameData().SND_LEVEL_START);
_step = showLevel;
}
}
function showLevel() {
_currentLevelFrame++;
_levelPrompt.moveToFrame(_currentLevelFrame);
if (_currentLevelFrame == 50) {
_gameContext.getGameData().createParticlesForLevelIntro();
}
if (_gameContext.getGameData().getLevel() == 6) {
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "Cabin Fever";
} else if (_gameContext.getGameData().getLevel() == 11) {
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "What\u2019s Cookin\u2019?";
} else {
_levelPrompt.getMovieClip().levelTxt.levelMsg.text = "Level " + _gameContext.getGameData().getLevel();
}
if (_currentLevelFrame == 100) {
_entity.setNextState(Game.AIStates.AI_WaitToPick);
}
}
}
Symbol 179 MovieClip [__Packages.Base.Profile] Frame 0
class Base.Profile
{
var _gameContext, _profiles;
function Profile (gameContext) {
_gameContext = gameContext;
_profiles = [];
}
function RegisterProfile(name) {
_profiles.push(new Object());
var _local2 = _profiles.length - 1;
_profiles[_local2].name = name;
_profiles[_local2].startTime = 0;
_profiles[_local2].endTime = 0;
}
function StartProfile(name) {
var _local2 = 0;
while (_local2 < _profiles.length) {
if (_profiles[_local2].name == name) {
_profiles[_local2].startTime = getTimer();
_profiles[_local2].endTime = 0;
}
_local2++;
}
}
function EndProfile(name) {
var _local2 = 0;
while (_local2 < _profiles.length) {
if (_profiles[_local2].name == name) {
_profiles[_local2].endTime = getTimer();
}
_local2++;
}
}
function ReportProfile() {
var _local2 = 0;
while (_local2 < _profiles.length) {
var _local3 = _profiles[_local2].endTime - _profiles[_local2].startTime;
_local2++;
}
}
}
Symbol 180 MovieClip [__Packages.Base.Background] Frame 0
class Base.Background
{
var _gameContext, _num, _scrollSpeed, _backgroundTimer, fg, _currentDepth, fg_bmp;
function Background (gameContext) {
_gameContext = gameContext;
_num = 196;
_scrollSpeed = 0.05;
_backgroundTimer = _scrollSpeed;
fg = [];
_currentDepth = 0;
}
function addBackground(graphicName, numBackgrounds, loop, offsetY) {
fg_bmp = flash.display.BitmapData.loadBitmap(graphicName);
var _local3 = new Object();
_local3.amountToMoveX = 0;
_local3.amountToMoveY = 0;
_local3.bitmapWidth = fg_bmp.width;
_local3.numBackgrounds = numBackgrounds;
_local3.loop = loop;
_local3._screen = [];
fg.push(_local3);
var _local2 = 0;
while (_local2 < numBackgrounds) {
var _local4 = (_local3.bitmapWidth * _local2) - 1;
_currentDepth++;
_local3._screen.push(_gameContext.getParent().createEmptyMovieClip("background" + _currentDepth, _currentDepth));
_local3._screen[_local2].attachBitmap(fg_bmp, 1);
_local3._screen[_local2].rect = new flash.geom.Rectangle(0, 0, Stage.width, Stage.height);
_local3._screen[_local2].bmp = fg_bmp;
if (_local2 == 0) {
_local3._screen[_local2].rect.offset(1, (fg_bmp.height + offsetY) - Stage.height);
} else {
_local3._screen[_local2].rect.offset(-_local4, (fg_bmp.height + offsetY) - Stage.height);
}
_local3._screen[_local2].scrollRect = _local3._screen[_local2].rect;
_local2++;
}
fg[fg.length - 1].amountToMoveX = 0;
fg[fg.length - 1].amountToMoveY = 0;
return(fg.length);
}
function scrollClip(mc, x, y) {
var _local2 = 0;
while (_local2 < mc.numBackgrounds) {
mc._screen[_local2].rect.offset(x, y);
_local2++;
}
if (mc._screen[0].rect.left <= 0) {
_local2 = 0;
while (_local2 < mc.numBackgrounds) {
mc._screen[_local2].rect.x = mc._screen[_local2].rect.x + mc.bitmapWidth;
_local2++;
}
} else if (mc._screen[0].rect.right > (mc.bitmapWidth + Stage.width)) {
_local2 = 0;
while (_local2 < mc.numBackgrounds) {
mc._screen[_local2].rect.x = mc._screen[_local2].rect.x - mc.bitmapWidth;
_local2++;
}
}
_local2 = 0;
while (_local2 < mc.numBackgrounds) {
mc._screen[_local2].scrollRect = mc._screen[_local2].rect;
_local2++;
}
}
function moveBack(gameContext) {
var _local2 = fg.length;
if (_local2 < 1) {
return(undefined);
}
while (_local2--) {
if ((fg[_local2].amountToMoveX == 0) && (fg[_local2].amountToMoveY == 0)) {
continue;
}
scrollClip(fg[_local2], fg[_local2].amountToMoveX, fg[_local2].amountToMoveY);
fg[_local2].amountToMoveX = 0;
fg[_local2].amountToMoveY = 0;
}
return(undefined);
}
function setAmountToMove(screenNum, x, y) {
fg[screenNum].amountToMoveX = x;
fg[screenNum].amountToMoveY = y;
}
function removeAllBackgrounds() {
var _local3 = fg.length;
while (_local3--) {
var _local2 = fg[_local3]._screen.length;
while (_local2--) {
fg[_local3]._screen[_local2].removeMovieClip();
}
}
_currentDepth = 0;
}
}
Symbol 156 MovieClip [_GameEntry] Frame 1
#initclip 25
Object.registerClass("_GameEntry", Base.GameEntry);
#endinitclip