Frame 1
function gotoWitchPage() {
getURL ("www.abckids.com");
}
function Doge_PlayAgain() {
Doge_Close();
startNewGame();
hideQuit();
}
function Doge_Load() {
_level0.createEmptyMovieClip("DOGE", 1500);
_level0.DOGE._x = 61;
_level0.DOGE._y = 80;
}
function Doge_Open(t_score) {
_level0.playerScore = t_score;
_level0.DOGE.loadMovie(_level0.dogePath, 1);
}
function Doge_Close() {
removeMovieClip(_level0.DOGE);
Doge_Load();
}
function Doge_Init(t_path, t_event, t_subject) {
trace("-- Init Doge --");
_level0.dogePath = t_path;
_level0.eventID = t_event;
_level0.subject = t_subject;
_level0.playerScore = 0;
Doge_Load();
}
function Doge_run() {
_level0.DOGE.loadMovie(_level0.dogePath, 1);
}
Array.prototype.indexOf = function (v, iStart) {
var _local3 = this;
var _local2 = _local3.length;
var _local1 = Math.max(0, iStart);
while (_local1 < _local2) {
if (_local3[_local1] == v) {
return(_local1);
}
_local1++;
}
return(-1);
};
Array.prototype.lastIndexOf = function (v, iStart) {
var _local2 = this;
var _local3 = v;
var _local1 = Math.min(_local2.length, iStart);
while (_local1 > 0) {
if (_local2[_local1] == _local3) {
return(_local1);
}
_local1--;
}
return(-1);
};
Array.prototype.remove = function (v) {
var _local2 = this;
var _local3 = _local2.length - 1;
var _local1 = _local3;
while (_local1 >= 0) {
if (_local2[_local1] == v) {
_local2.splice(_local1, 1);
}
_local1--;
}
};
Array.prototype.swap = function (iA, iB) {
var _local1 = this;
var _local2 = _local1[iA];
_local1[iA] = _local1[iB];
_local1[iB] = _local2;
};
Array.prototype.bubbleSortOn = function (sProp) {
var _local2 = this;
if (sProp == null) {
return(null);
}
var vA;
var _local3 = 0;
while (_local3 < _local2.length) {
vA = _local2[_local3][sProp];
var _local1 = 0;
while (_local1 < _local2.length) {
if (vA < _local2[_local1][sProp]) {
_local2.swap(_local3, _local1);
break;
}
_local1++;
}
_local3++;
}
return(undefined);
};
Array.prototype.findOn = function (sName, vValue, iFrom) {
var _local2 = iFrom;
var _local3 = this;
trace("asd");
var _local1 = ((_local2 != null) ? (_local2) : 0);
while (_local1 < _local3.length) {
if (_local3[_local1][sName] == vValue) {
return(_local1);
}
_local1++;
}
return(-1);
};
if (Array.prototype.oldSortOn == null) {
Array.prototype.oldSortOn = Array.prototype.sortOn;
Array.prototype.sortOn = function (sField) {
var _local1 = this;
if (getPublishFormat() == 5) {
_level0.__tmp = sField;
_local1.sort(_local1.F5sortOn);
delete _level0.__tmp;
} else {
_local1.oldSortOn(sField);
}
};
Array.prototype.F5sortOn = function (oA, oB) {
var _local2 = oB;
var _local3 = oA;
var _local1 = _level0.__tmp;
if (_local3[_local1] != null) {
if (_local3[_local1] < _local2[_local1]) {
return(-1);
}
if (_local3[_local1] > _local2[_local1]) {
return(1);
}
return(0);
}
if (_local2[_local1] != null) {
return(1);
}
return(0);
};
}
Object.prototype.addListener = function (oRef) {
var _local1 = this;
var _local2 = oRef;
if (_local1._listeners == null) {
_local1._listeners = [_local2];
} else if (_local1._listeners.indexOf(_local2) == -1) {
_local1._listeners.push(_local2);
}
};
Object.prototype.removeListener = function (oRef) {
var _local1 = this;
_local1._listeners.remove(oRef);
if (_local1._listeners.length == 0) {
delete _local1._listeners;
}
};
Object.prototype.removeAllListeners = function () {
delete this._listeners;
};
Object.prototype.sendEvent = function (sEventName) {
var _local3 = this;
var _local1 = arguments;
var _local2 = _local3._listeners.length - 1;
while (_local2 >= 0) {
_local3._listeners[_local2][sEventName](_local1[1], _local1[2], _local1[3], _local1[4], _local1[5], _local1[6], _local1[7], _local1[8], _local1[9], _local1[10], _local1[11], _local1[12], _local1[13], _local1[14], _local1[15]);
_local2--;
}
};
var _waiting = false;
var _waitUntil = 0;
MovieClip.prototype.CallStackClass = function (iInterval) {
var _local1 = this;
_local1.list = [];
_local1.waiting = false;
_local1.waitUntil = 0;
_local1.interval = Math.max(1, ((iInterval == null) ? 10 : (iInterval)));
_local1.maxLoops = 5;
};
_p = CallStackClass.prototype;
_p.interval = 10;
_p.maxLoops = 5;
_p.append = function (fn) {
this.list.push(arguments);
};
_p.clear = function () {
this.list = [];
};
_p.start = function (fnCallBack, iInterval) {
var _local1 = this;
var _local2 = fnCallBack;
var _local3 = iInterval;
trace("start");
_local1.notify = _local2;
_local1.index = 0;
_local1.loops = 0;
_local1.count = 0;
_local1.active = true;
_local1.lastTime = getTimer();
if ((typeof(_local3) == "number") && (!isNaN(_local3))) {
_local1.interval = _local3;
}
_local1.intervalID = setInterval(function (cs) {
cs.update();
}, _local1.interval, _local1);
if (_local2) {
_local1.onFinish = _local2;
}
};
_p.wait = function (iMilliseconds) {
this.waitFor = iMilliseconds;
this.waiting = true;
return(false);
};
_p.update = function () {
var _local2 = this;
var currentTime = getTimer();
var elapsed = (currentTime - _local2.lastTime);
_local2.lastTime = currentTime;
if (!_local2.active) {
return(null);
}
if (_local2.waiting) {
_local2.waitFor = _local2.waitFor - elapsed;
if (_local2.waitFor > 0) {
return(null);
}
_local2.waiting = false;
_local2.index++;
}
count++;
var i = 0;
var maxTime = (currentTime + _local2.interval);
if ((i < _local2.maxLoops) || (maxTime > getTimer())) {
loops++;
i++;
var _local1 = _local2.list[_local2.index];
if (_local1 == null) {
if (_local2.index == _local2.list.length) {
_local2.end();
}
} else if (_local1[0] == _local2.wait) {
_local2.wait(_local1[1]);
_local2.index++;
} else {
var _local3 = _local1[0](_local1[1], _local1[2], _local1[3], _local1[4], _local1[5], _local1[6], _local1[7], _local1[8], _local1[9], _local1[10]);
if (_local3 || (_local3 == null)) {
_local2.index++;
if (_local2.index == _local2.list.length) {
_local2.end();
updateAfterEvent();
return(true);
}
// unexpected jump
}
}
}
updateAfterEvent();
return(false);
};
_p.end = function () {
var _local1 = this;
clearInterval(_local1.intervalID);
_local1.intervalID = null;
_local1.onFinish(_local1);
};
delete _p;
MovieClip.prototype.addTweenToStack = function (CS) {
T = new TweenClass();
CS.append(T.start, T);
CS.append(T.update, T);
return(t);
};
MovieClip.prototype.TweenClass = function () {
this.list = [];
this.auto = false;
};
_p = TweenClass.prototype;
_p.createNewTween = function (mc) {
var _local2 = this;
var _local1 = new _local2.TweenObject(_local2, mc);
_local2.list.push(_local1);
return(_local1);
};
_p.start = function (oRef) {
if (oRef != null) {
return(oRef.start());
}
var listEntry;
var mc;
var time;
this.lastTime = getTimer() * 0.001;
this.running = true;
};
_p.update = function (v0) {
switch (typeof(v0)) {
case "object" :
return(v0.update());
case "number" :
var _local2 = v0;
break;
default :
_local2 = Math.min((-this.lastTime) + ((this.lastTime = getTimer() * 0.001)), 0.1);
}
var _local1;
var mc;
var _local3 = this.list.length - 1;
while (_local3 >= 0) {
_local1 = this.list[_local3];
mc = _local1.target;
if (_local1.positionTween) {
_local1.updatePosition(_local2);
}
if (_local1.scaleTween) {
_local1.updateScale(_local2);
}
if (_local1.rotTween) {
_local1.updateRotation(_local2);
}
if (_local1.colorTween) {
_local1.updateColor(_local2);
}
if (_local1.offsetTween || (_local1.percentTween)) {
_local1.updateTint(_local2);
}
if (_local1.alphaTween) {
_local1.updateAlpha(_local2);
}
if (_local1.isDone()) {
this.list.splice(_local3, 1);
}
_local3--;
}
if (this.list.length <= 0) {
this.onDone();
return(true);
}
return(false);
};
_p.skip = function () {
var _local2 = this;
trace("SKIP");
var _local1 = 0;
while (_local1 < _local2.list.length) {
_local2.list[_local1].end();
_local1++;
}
_local2.update();
};
_p.TweenObject = function (oTween, mc) {
this.tween = oTween;
this.target = mc;
};
_p.TweenObject.prototype.addPosition = function (fSec, iDestX, iDestY) {
var _local1 = this;
var _local2 = arguments;
var _local3 = fSec;
_local1.positionTime = _local3;
_local1.positionTween = true;
switch (typeof(_local2[3])) {
case "number" :
var startX = _local2[3];
var startY = _local2[4];
_local1.onPositionDone = _local2[5];
break;
case "function" :
default :
_local1.onPositionDone = _local2[3];
var startX = _local1.target._x;
var startY = _local1.target._y;
}
_local1.velX = (iDestX - startX) / _local3;
_local1.velY = (iDestY - startY) / _local3;
_local1.destX = iDestX;
_local1.destY = iDestY;
};
_p.TweenObject.prototype.updatePosition = function (fElapsed) {
var _local1 = this;
var _local3 = fElapsed;
var _local2 = _local1.target;
_local1.positionTime = _local1.positionTime - _local3;
_local1.positionTween = _local1.positionTime > 0;
if (!_local1.positionTween) {
_local1.onPositionDone();
_local2._x = _local1.destX;
_local2._y = _local1.destY;
} else {
_local2._x = _local2._x + (_local3 * _local1.velX);
_local2._y = _local2._y + (_local3 * _local1.velY);
}
};
_p.TweenObject.prototype.addScale = function (fSec, iScaleX, iScaleY, fnOnScaleDone) {
var _local1 = this;
var _local2 = fSec;
var _local3 = iScaleX;
_local1.scaleTime = _local2;
_local1.scaleTween = true;
_local1.scaleX = (_local3 - _local1.target._xscale) / _local2;
_local1.scaleY = (_local3 - _local1.target._xscale) / _local2;
_local1.destScaleX = _local3;
_local1.destScaleY = iScaleY;
_local1.startScaleX = _local1.target._xscale;
_local1.startScaleY = _local1.target._yscale;
_local1.onScaleDone = fnOnScaleDone;
};
_p.TweenObject.prototype.updateScale = function (fElapsed) {
var _local1 = this;
var _local3 = Math.min(fElapsed, _local1.scaleTime);
var _local2 = _local1.target;
_local1.scaleTime = _local1.scaleTime - _local3;
_local1.scaleTween = _local1.scaleTime > 0;
if (!_local1.scaleTween) {
_local1.onScaleDone();
_local2._xscale = _local1.destScaleX;
_local2._yscale = _local1.destScaleY;
} else {
_local2._xscale = _local2._xscale + (_local3 * _local1.scaleX);
_local2._yscale = _local2._yscale + (_local3 * _local1.scaleY);
}
};
_p.TweenObject.prototype.addRotation = function (fSec, iRot, fnOnRotDone) {
var _local1 = this;
_local1.rotTime = fSec;
_local1.rotTween = true;
_local1.rot = (iRot - _local1.target._rotation) / fSec;
_local1.startRotation = _local1.target._rotation;
_local1.onRotDone = fnOnRotDone;
_local1.destRotation = iRot;
};
_p.TweenObject.prototype.updateRotation = function (fElapsed) {
var _local1 = this;
var _local3 = Math.min(fElapsed, _local1.rotTime);
var _local2 = _local1.target;
_local1.rotTime = _local1.rotTime - _local3;
_local1.rotTween = _local1.rotTime > 0;
if (!_local1.rotTween) {
_local1.onRotDone();
_local2._rotation = _local1.destRotation;
} else {
_local2._rotation = _local2._rotation + (_local3 * _local1.rot);
}
};
_p.TweenObject.prototype.addAlpha = function (fSec, iAlpha, iStartAlpha, fnOnAlphaDone) {
var _local1 = this;
_local1.alphaTime = fSec;
_local1.alphaTween = true;
_local1.startAlpha = ((iStartAlpha == null) ? (_local1.target._alpha) : (iStartAlpha));
_local1.alpha = (iAlpha - _local1.startAlpha) / fSec;
trace(_local1.alpha);
_local1.onAlphaDone = fnOnAlphaDone;
_local1.destAlpha = iAlpha;
};
_p.TweenObject.prototype.updateAlpha = function (fElapsed) {
var _local1 = this;
var _local2 = Math.min(fElapsed, _local1.alphaTime);
var _local3 = _local1.target;
_local1.alphaTime = _local1.alphaTime - _local2;
_local1.alphaTween = _local1.alphaTime > 0;
trace(_local2 * _local1.alpha);
if (!_local1.alphaTween) {
_local1.onAlphaDone();
_local3._alpha = _local1.destAlpha;
} else {
_local3._alpha = int((_local1.startAlpha = _local1.startAlpha + (_local2 * _local1.alpha)));
}
};
_p.TweenObject.prototype.addColor = function (fSec, iStartColor, iEndColor) {
var _local1 = this;
var _local2 = iStartColor;
_local1.colorTime = fSec;
_local1.colorTween = true;
if (_local1.target.colorObj != null) {
_local1.colorObj = _local1.target.colorObj;
if (_local2 == null) {
_local2 = _local1.colorObj.getRGB();
}
} else {
_local1.target.colorObj = (_local1.colorObj = new Color(_local1.target));
}
_local1.colorObj.setRGB(_local2);
var iStartR = ((_local1.currentR = _local2 >> 16));
var iStartG = ((_local1.currentG = (_local2 >> 8) - (iStartR << 8)));
var iStartB = ((_local1.currentB = ((_local2 >> 0) - (iStartG << 8)) - (iStartR << 16)));
var _local3 = (_local1.destR = iEndColor >> 16);
var iEndG = ((_local1.destG = (iEndColor >> 8) - (_local3 << 8)));
var iEndB = ((_local1.destB = ((iEndColor >> 0) - (iEndG << 8)) - (_local3 << 16)));
_local1.colorR = (_local3 - iStartR) / fSec;
_local1.colorG = (iEndG - iStartG) / fSec;
_local1.colorB = (iEndB - iStartB) / fSec;
};
_p.TweenObject.prototype.updateColor = function (fElapsed) {
var _local1 = this;
var _local2 = Math.min(fElapsed, _local1.colorTime);
var mc = _local1.target;
_local1.colorTime = _local1.colorTime - _local2;
_local1.colorTween = _local1.colorTime > 0;
if (!_local1.colorTween) {
_local1.onColorDone();
_local1.currentR = _local1.destR;
_local1.currentG = _local1.destG;
_local1.currentB = _local1.destB;
} else {
_local1.currentR = _local1.currentR + (_local1.colorR * _local2);
_local1.currentG = _local1.currentG + (_local1.colorG * _local2);
_local1.currentB = _local1.currentB + (_local1.colorB * _local2);
}
_local1.colorObj.setRGB(Math.round(((_local1.currentR << 16) + (_local1.currentG << 8)) + _local1.currentB));
};
_p.TweenObject.prototype.addOffsetTint = function (fSec, iStartR, iStartG, iStartB, iStartA, iEndR, iEndG, iEndB, iEndA, fnOnOffsetDone) {
var _local1 = this;
var _local3 = fSec;
_local1.offsetTime = _local3;
_local1.offsetTween = true;
if (_local1.target.colorObj != null) {
_local1.colorObj = _local1.target.colorObj;
} else {
_local1.target.colorObj = (_local1.colorObj = new Color(_local1.target));
}
if (_local1.currentTint == null) {
_local1.currentTint = _local1.colorObj.getTransform();
}
var _local2 = _local1.currentTint;
_local2.rb = ((iStartR != null) ? (iStartR) : (_local2.rb));
_local2.gb = ((iStartG != null) ? (iStartG) : (_local2.gb));
_local2.bb = ((iStartB != null) ? (iStartB) : (_local2.bb));
_local2.ab = ((iStartA != null) ? (iStartA) : (_local2.ab));
_local1.offsetR = (iEndR - iStartR) / _local3;
_local1.offsetG = (iEndG - iStartG) / _local3;
_local1.offsetB = (iEndB - iStartB) / _local3;
_local1.offsetA = (iEndA - iStartA) / _local3;
_local1.destOffsetR = iEndR;
_local1.destOffsetG = iEndG;
_local1.destOFfsetB = iEndB;
_local1.destOffsetA = iEndA;
_local1.onOffsetDone = fnOnOffsetDone;
};
_p.TweenObject.prototype.updateOffsetTint = function (fElapsed) {
var _local1 = this;
var _local3 = Math.min(fElapsed, _local1.offsetTime);
var mc = _local1.target;
var _local2 = _local1.currentTint;
_local1.offsetTime = _local1.offsetTime - _local3;
_local1.offsetTween = _local1.offsetTime > 0;
if (!_local1.offsetTween) {
_local1.onOffsetDone();
_local2.rb = _local1.destOffsetR;
_local2.gb = _local1.destOffsetG;
_local2.bb = _local1.destOffsetB;
_local2.ab = _local1.destOffsetA;
} else {
_local2.rb = _local2.rb + (_local1.offsetR * _local3);
_local2.gb = _local2.gb + (_local1.offsetG * _local3);
_local2.bb = _local2.bb + (_local1.offsetB * _local3);
_local2.ab = _local2.ab + (_local1.offsetA * _local3);
}
};
_p.TweenObject.prototype.addPercentTint = function (fSec, iStartR, iStartG, iStartB, iStartA, iEndR, iEndG, iEndB, iEndA, fnOnPercentDone) {
var _local1 = this;
var _local3 = fSec;
_local1.percentTime = _local3;
_local1.percentTween = true;
if (_local1.target.colorObj != null) {
_local1.colorObj = _local1.target.colorObj;
} else {
_local1.target.colorObj = (_local1.colorObj = new Color(_local1.target));
}
if (_local1.currentTint == null) {
_local1.currentTint = _local1.colorObj.getTransform();
}
var _local2 = _local1.currentTint;
_local2.ra = ((iStartR != null) ? (iStartR) : (_local2.ra));
_local2.ga = ((iStartG != null) ? (iStartG) : (_local2.ga));
_local2.ba = ((iStartB != null) ? (iStartB) : (_local2.ba));
_local2.aa = ((iStartA != null) ? (iStartA) : (_local2.aa));
_local1.percentR = (iEndR - iStartR) / _local3;
_local1.percentG = (iEndG - iStartG) / _local3;
_local1.percentB = (iEndB - iStartB) / _local3;
_local1.percentA = (iEndA - iStartA) / _local3;
_local1.destPercentR = iEndR;
_local1.destPercentG = iEndG;
_local1.destPercentB = iEndB;
_local1.destPercentA = iEndA;
_local1.onPercentDone = fnOnPercentDone;
};
_p.TweenObject.prototype.updatePercentTint = function (fElapsed) {
var _local1 = this;
var _local3 = Math.min(fElapsed, _local1.percentTime);
var mc = _local1.target;
var _local2 = _local1.currentTint;
_local1.percentTime = _local1.percentTime - _local3;
_local1.percentTween = _local1.percentTime > 0;
if (!_local1.percentTween) {
_local1.onOffsetDone();
_local2.ra = _local1.destPercentR;
_local2.ga = _local1.destPercentG;
_local2.ba = _local1.destPercentB;
_local2.aa = _local1.destPercentA;
} else {
_local2.ra = _local2.ra + (_local1.percentR * _local3);
_local2.ga = _local2.ga + (_local1.percentG * _local3);
_local2.ba = _local2.ba + (_local1.percentB * _local3);
_local2.aa = _local2.aa + (_local1.percentA * _local3);
}
};
_p.TweenObject.prototype.updateTint = function (fElapsed) {
var _local1 = this;
if (_local1.offsetTween) {
_local1.updateOffsetTint(fElapsed);
}
if (_local1.percentTween) {
_local1.updatePercentTint(fElapsed);
}
_local1.colorObj.setTransform(_local1.currentTint);
};
_p.TweenObject.prototype.isDone = function () {
var _local1 = this;
return(((((((!_local1.positionTween) && (!_local1.scaleTween)) && (!_local1.rotTween)) && (!_local1.alphaTween)) && (!_local1.colorTween)) && (!_local1.offsetTween)) && (!_local1.percentTween));
};
_p.TweenObject.prototype.end = function () {
var _local1 = this;
_local1.positionTime = 0;
_local1.scaleTime = 0;
_local1.rotTime = 0;
_local1.alphaTime = 0;
_local1.colorTime = 0;
_local1.percentTime = 0;
_local1.offsetTime = 0;
};
delete _p;
MovieClip.prototype.Grid2D = function () {
this.grid = [];
};
Grid2D.prototype.setVar = function (iX, iY, vVar) {
var _local1 = this;
var _local2 = iX;
if (_local1.grid[_local2] == null) {
_local1.grid[_local2] = [];
}
_local1.grid[_local2][iY] = vVar;
};
Grid2D.prototype.empty = function () {
this.grid = [];
};
Grid2D.prototype.getVar = function (iX, iY) {
return(this.grid[iX][iY]);
};
MovieClip.prototype.setTimeout = function (fn, iMilli) {
arguments.id = setInterval(____FLASHMX____onTimeout, iMilli, arguments);
};
MovieClip.prototype.____FLASHMX____onTimeout = function (a) {
var _local1 = a;
_local1[0](_local1[2], _local1[3], _local1[4], _local1[5], _local1[6], _local1[7], _local1[8], _local1[9], _local1[10], _local1[11], _local1[12], _local1[13], _local1[14], _local1[15], _local1[16], _local1[17], _local1[18], _local1[19], _local1[20], _local1[21]);
clearInterval(_local1.id);
};
startTime = getTimer();
_level0._root.fsdPlayAgain = function () {
Doge_PlayAgain();
};
var dogePath = _level0.fsd;
var dogeEventID = "jetix_witchelements_4843";
var dogeSubject = "WITCH Elements Unite High Score!";
Doge_Init(dogePath, dogeEventID, dogeSubject);
Frame 3
_global.performance = new Classes.c_PerformanceTest(null, function () {
gotoAndStop ("start");
});
stop();
Frame 5
stop();
Instance of Symbol 96 MovieClip "mcHelp" in Frame 5
onClipEvent (load) {
_visible = false;
}
Frame 10
function appendLevel() {
var _local1;
_local1 = new LevelClass();
Levels.push(_local1);
return(_local1);
}
function LevelClass() {
}
function SubmitScore() {
mcDialog.gotoAndStop("loading");
Doge_Open(Score);
}
function StartNewGame() {
gotoAndStop ("Game");
FSD._visible = false;
btn._visible = false;
unpause();
mcDialog._visible = false;
btn._visible = false;
CurrentLevel = 0;
setScore(0);
StartGame();
}
function setQuitEnabled(bEnabled) {
btnQuit.enabled = (canQuit = bEnabled);
}
function showMenu() {
pause();
mcDialog.showDialog("menu");
mcDialog.score = score;
}
function showQuit() {
if (!canQuit) {
return(false);
}
pause();
mcDialog.showDialog("quit");
mcDialog.score = score;
}
function cancelDialog() {
mcDialog.hideDialog();
unpause();
}
function setHelpEnabled(bEnabled) {
btnHelp.enabled = bEnabled;
canShowHelp = bEnabled;
}
function showHelp(t_newGame) {
if (!CanShowHelp) {
return(false);
}
pause();
mcHelp._visible = true;
mcHelp.newGameOnCancel = t_newGame;
}
function hideHelp() {
unpause();
mcHelp._visible = false;
}
function setScore(iScore, bCount) {
Score = Math.max(0, Math.ceil(iScore));
mcScoreBox.setScore(Score, bCount, 0.5);
}
function CalculateSpeedMultiplier() {
speedMultiplier = Math.ceil(1000 / (mcGame.getTileRate() * (CurrentLevel + 1)));
}
function shiftScore(iAmmount) {
Score = Score + iAmmount;
Score = Math.max(0, Math.ceil(Score));
mcScoreBox.setScore(Score, true, 0.5);
}
function CompleteLevel() {
setHelpEnabled(false);
setQuitEnabled(false);
audio.playSound("endOfQuarter");
if ((CurrentLevel + 1) < Levels.length) {
mcDialog.showDialog("Q" + currentLevel);
}
clearInterval(MainUpdateInterval);
mcGame.active = false;
SetTimeout(GotoNextLevel, 3000);
gotoAndStop ("levelComplete");
}
function GotoNextLevel() {
CurrentLevel++;
if (CurrentLevel >= Levels.length) {
gotoAndStop ("wingame");
} else {
gotoAndStop ("game");
StartGame();
}
}
function StartGame() {
mcDialog.hideDialog();
mcGame.reset();
mcGame.sendEvent("onGameReady");
}
function StartLevel(oLevel) {
var _local1 = oLevel;
RemainingRows = _local1.totalRows;
CurrentLevelObj = _local1;
mcGame.useBombs = _local1.useBombs;
mcGame.bombOdds = _local1.bombOdds;
mcGame.useColorBombs = _local1.useColorBombs;
mcGame.colorBombOdds = _local1.colorBombOdds;
mcGame.useIndestructibles = _local1.useIndestructibles;
mcGame.IndestructiblesOdds = _local1.IndestructiblesOdds;
mcGame.setSize(_local1.columns, _local1.rows, _local1.cellWidth, _local1.cellHeight);
mcGame.setColors(_local1.colors);
mcGame.generateRows(_local1.startRows);
mcGame.setTileRate(_local1.speed);
mcGame.start();
MainUpdateInterval = setInterval(update, 50);
LastTime = getTimer() * 0.001;
CurrentTime = TimePerLevel;
CalculateSpeedMultiplier();
setHelpEnabled(true);
setQuitEnabled(true);
display.gotoAndStop(CurrentLevel + 1);
mcScoreBox.setTime(CurrentTime);
mcScoreBox.setLevel(CurrentLevel + 1);
setScore(Number(Score));
gotoAndStop ("Game");
}
function pause() {
if (!mcGame.active) {
return(null);
}
paused = true;
mcGame.pause();
trace("game paused");
}
function unpause() {
if (!mcGame.active) {
return(null);
}
mcGame.unpause();
trace("game unpaused");
paused = false;
}
function update() {
var _local1 = getTimer() * 0.001;
var _local2 = _local1 - LastTime;
LastTime = _local1;
if (paused || (!mcGame.active)) {
return(false);
}
OldTime = CurrentTime;
CurrentTime = CurrentTime - _local2;
if ((OldTime > 4) && (CurrentTime <= 4)) {
audio.playSound("Clock");
}
if (CurrentTime <= 0) {
CurrentTime = 0;
CompleteLevel();
}
mcScoreBox.setTime(CurrentTime);
return(undefined);
}
var MainUpdateInterval;
Score = 0;
if (_global.performance > 1200) {
_quality = "HIGH";
} else {
_quality = "MEDIUM";
}
var TimePerLevel = 60;
var LCP = LevelClass.prototype;
var Colors3 = [1, 2, 3];
var Colors4 = [1, 2, 3, 4];
var Colors5 = [1, 2, 3, 4, 5];
LCP.CellWidth = 27;
LCP.CellHeight = 27;
LCP.Rows = 14;
LCP.Columns = 11;
LCP.StartRows = 4;
LCP.TotalRows = 40;
LCP.Colors = Colors3;
LCP.Speed = 500;
LCP.SpeedUpEvery = 20;
LCP.SpeedUpBy = 75;
LCP.useBombs = false;
LCP.bombOdds = 300;
LCP.useColorBombs = false;
LCP.colorBombOdds = 200;
LCP.useIndestructibles = true;
LCP.IndestructiblesOdds = 100;
LCP.assetLinkageName = "tile";
LCP.onLevelUsed = function () {
};
var TmpLevel;
var Levels = [];
TmpLevel = appendLevel();
TmpLevel.speedUpBy = 30;
TmpLevel.speedUpEvery = 20;
TmpLevel.speed = 500;
TmpLevel.colors = colors3;
TmpLevel.useBombs = true;
TmpLevel = appendLevel();
TmpLevel.speed = 450;
TmpLevel.startRows = 5;
TmpLevel.speedUpBy = 50;
TmpLevel.speedUpEvery = 20;
TmpLevel.colors = colors4;
TmpLevel.useBombs = true;
TmpLevel.useColorBombs = true;
TmpLevel = appendLevel();
TmpLevel.startRows = 6;
TmpLevel.colors = colors4;
TmpLevel.speed = 400;
TmpLevel.speedUpBy = 50;
TmpLevel.speedUpEvery = 15;
TmpLevel.IndestructiblesOdds = 75;
TmpLevel.useBombs = true;
TmpLevel.useColorBombs = true;
TmpLevel.colorBombOdds = 220;
TmpLevel = appendLevel();
TmpLevel.startRows = 6;
TmpLevel.speed = 300;
TmpLevel.colors = colors5;
TmpLevel.speedUpBy = 75;
TmpLevel.speedUpEvery = 13;
TmpLevel.IndestructiblesOdds = 60;
TmpLevel.useBombs = true;
TmpLevel.useColorBombs = true;
TmpLevel.colorBombOdds = 160;
TmpLevel = appendLevel();
TmpLevel.startRows = 7;
TmpLevel.speed = 200;
TmpLevel.colors = colors5;
TmpLevel.speedUpBy = 90;
TmpLevel.speedUpEvery = 10;
TmpLevel.IndestructiblesOdds = 40;
TmpLevel.useBombs = true;
TmpLevel.useColorBombs = true;
TmpLevel.colorBombOdds = 160;
attachMovie("square_btn", "btn", 900);
btn._visible = false;
btn.useHandCursor = false;
btn._xscale = 600;
btn._yscale = 440;
CurrentLevel = 0;
gameListener = {};
gameListener.onGameReady = function () {
startLevel(Levels[CurrentLevel]);
};
gameListener.onGameLost = function () {
mcGame.active = false;
audio.PlaySound("lose");
clearInterval(MainUpdateInterval);
mcDialog.showDialog("lose");
};
gameListener.onWarning = function (iEmptyCount) {
trace("Warning! " + iEmptyCount);
};
gameListener.onUseColorBomb = function (iTiles, iColor) {
var _local1 = iTiles;
var _local2 = int(((_local1 * _local1) * (CurrentLevel + 1)) * 0.75) * speedMultiplier;
trace(_local2);
shiftScore(_local2);
audio.playSound("bomb");
if (_local1 < 8) {
} else if (_local1 < 20) {
audio.playSound("smallCheer");
} else {
audio.playSound("bigCheer");
}
};
gameListener.onUseBomb = function (iTiles) {
var _local1 = iTiles;
var _local2 = int(((_local1 * _local1) * (CurrentLevel + 1)) * 0.5);
trace(_local2);
shiftScore(_local2);
audio.playSound("bomb");
if (_local1 < 8) {
} else if (_local1 < 20) {
audio.playSound("smallCheer");
} else {
audio.playSound("bigCheer");
}
};
gameListener.onTileQueued = function () {
};
gameListener.onRowAdded = function (iTotal) {
if ((iTotal % CurrentLevelObj.speedUpEvery) == 0) {
mcGame.setTileRate(mcGame.getTileRate() - CurrentLevelObj.SpeedUpBy);
CalculateSpeedMultiplier();
}
shiftScore((speedMultiplier * iTotal) * 0.5);
};
gameListener.onCompleteSet = function (iTiles) {
var _local1 = iTiles;
var _local2 = (((_local1 * _local1) * _local1) * (CurrentLevel + 1)) * speedMultiplier;
trace(_local2);
shiftScore(_local2);
audio.playSound("set");
if (_local1 < 8) {
} else if (_local1 < 20) {
audio.playSound("smallCheer");
} else {
audio.playSound("bigCheer");
}
};
gameListener.onIncompleteSet = function () {
audio.playSound("incompleteSet");
};
gameListener.onResize = function () {
};
mcGame.addListener(gameListener);
gotoAndStop ("game");
Instance of Symbol 259 MovieClip "mcDialog" in Frame 10
onClipEvent (load) {
_visible = false;
}
Frame 15
mcGame._visible = true;
mcBG._visible = true;
mcBuildBarBG._visible = true;
mcScoreBox._visible = true;
Frame 39
mcGame._visible = false;
mcBG._visible = false;
mcBuildBarBG._visible = false;
mcScoreBox._visible = false;
mcEnding.mcScoreBox.score.text = _parent.score;
Symbol 2 Button [square_btn]
on (rollOver) {
_parent._parent.BuildBarRollOver();
}
on (rollOut, release, releaseOutside) {
_parent._parent.BuildBarRollOut();
_parent._parent.BuildBarRelease();
}
on (press) {
_parent._parent.BuildBarPress();
_parent._parent.BuildBarRollOver();
}
Symbol 3 MovieClip [buildbarCell] Frame 1
stop();
Symbol 14 MovieClip Frame 1
stop();
Symbol 22 MovieClip Frame 1
stop();
Symbol 23 MovieClip [tile] Frame 1
stop();
Symbol 275 MovieClip [__Packages.Classes.c_PerformanceTest] Frame 0
class Classes.c_PerformanceTest
{
function c_PerformanceTest (itterations, onComplete) {
var _local1 = this;
trace("-- Run Performance Test --");
if (itterations) {
_local1.loops = itterations;
}
_local1.remainingLoops = _local1.loops;
if (onComplete) {
_local1.onComplete = onComplete;
}
var _local2 = System.capabilities.version.substr(4).split(",");
_local1.flashMajorVersion = Number(_local2[0]);
_local1.flashMinorVersion = Number(_local2[2]);
_local1.complete = false;
_local1.intervalID = setInterval(function (o) {
o.test();
}, 0, _local1);
}
function test() {
var _local3 = this;
if (_local3.remainingLoops <= 0) {
_local3.finalize();
clearInterval(_local3.intervalID);
} else {
_local3.remainingLoops--;
var startTime = getTimer();
var _local2;
var _local1 = 0;
while (_local1 < 6400) {
_local2 = {};
_local1++;
}
_local3.time = _local3.time + (getTimer() - startTime);
}
}
function finalize() {
var _local1 = this;
_local1.score = Math.floor((_local1.loops / _local1.time) * 10000);
if (_local1.flashMajorVersion >= 7) {
_local1.log = Math.log(_local1.score * 0.015);
} else {
_local1.log = Math.log(_local1.score * 0.023);
}
_local1.processor = _local1.log * 1000;
_local1.complete = true;
trace(("-- Performance Complete : " + Math.floor(_local1.processor)) + " --");
_local1.onComplete(_local1);
}
function toString() {
var _local1 = this;
if (_local1.score) {
return((((((((("Loops:\t" + _local1.loops) + "\nFlash Version: \t") + System.capabilities.version) + "\nTotal Time:\t") + _local1.time) + "\nScore: \t") + _local1.score) + "\nProcessor: \t") + _local1.processor);
}
return("Test In Process.");
}
var score = 0;
var time = 0;
var loops = 20;
var complete = false;
}
Symbol 59 Button
on (release) {
_parent.gotoAndStop("GameInit");
}
Symbol 70 Button
on (release) {
_parent.mcHelp._visible = true;
_parent.mcHelp.newGameOnCancel = true;
}
Symbol 71 MovieClip Frame 40
stop();
Symbol 72 Button
on (release) {
if (newGameOnCancel) {
_parent.gotoAndStop("GameInit");
} else {
_parent.unpause();
_parent.mcDialog.hideDialog();
}
hide();
}
Symbol 79 Button
on (release) {
nextFrame();
}
Symbol 89 Button
on (release) {
prevFrame();
}
Symbol 95 MovieClip Frame 1
stop();
Symbol 96 MovieClip Frame 1
function hide() {
_visible = false;
gotoAndStop (1);
}
function show() {
_visible = true;
}
btnCover.useHandCursor = false;
stop();
Symbol 96 MovieClip Frame 2
function hide() {
_visible = false;
gotoAndStop (1);
}
function show() {
_visible = true;
}
btnCover.useHandCursor = false;
stop();
Symbol 108 MovieClip Frame 1
function playSound(sName) {
gotoAndPlay(sName);
}
function onEventSound() {
gotoAndStop (2);
}
MovieClip.prototype.audio = this;
stop();
Symbol 108 MovieClip Frame 5
onEventSound();
Symbol 108 MovieClip Frame 10
onEventSound();
Symbol 108 MovieClip Frame 15
onEventSound();
Symbol 108 MovieClip Frame 20
onEventSound();
Symbol 108 MovieClip Frame 25
onEventSound();
Symbol 108 MovieClip Frame 30
onEventSound();
Symbol 108 MovieClip Frame 35
onEventSound();
Symbol 108 MovieClip Frame 40
onEventSound();
Symbol 108 MovieClip Frame 45
onEventSound();
Symbol 108 MovieClip Frame 50
onEventSound();
Symbol 108 MovieClip Frame 55
onEventSound();
Symbol 108 MovieClip Frame 60
onEventSound();
Symbol 108 MovieClip Frame 65
onEventSound();
Symbol 112 MovieClip Frame 1
function reset() {
createEmptyMovieClip("mcGameArea", 10);
mcGameArea.createEmptyMovieClip("mcTiles", 0);
Grid = [];
Tiles = [];
totalTilesCreated = 0;
CurrentRow = 0;
}
function Tile(mcGame, iType, iColor, iX, iY) {
totalTilesCreated++;
this.color = iColor;
this.type = ((iType != null) ? (iType) : (NORMAL_TYPE));
this.gameBase = eval (_target);
mcGame.attachMovie(tileLinkageName, "mc" + totalTilesCreated, totalTilesCreated);
var mc = ((this.target = mcGame["mc" + totalTilesCreated]));
mc.tile = this;
mc.gotoAndStop(this.type);
if (this.type == NORMAL_TYPE) {
this.target.mcLines._rotation = colors.indexOf(iColor) * 90;
}
mc.btn.onPress = onTileClick;
mc.btn.useHandCursor = false;
mc.mcSymbol.gotoAndStop(iColor);
mc.color = iColor;
this.moveTo(iX, iY);
tiles.push(this);
}
function evaluateBoardStatus(iRows, iEmpty) {
if (iRows >= Rows) {
active = false;
SendEvent("onGameLost");
ClearInterval(_level0._GM_UpdateInterval);
} else if (iEmpty <= warningRows) {
SendEvent("onWarning", iEmpty);
}
}
function generateGrid(bCheckForEnd) {
var _local1;
var _local3;
var lowest;
var lowest = CurrentRow;
_local3 = 0;
Grid = new Grid2D();
var _local2 = 0;
while (_local2 < tiles.length) {
_local1 = tiles[_local2];
if (bCheckForEnd) {
_local3 = Math.max(_local1.y, _local3);
lowest = Math.min(_local1.y, lowest);
}
if (Grid.grid[_local1.x][_local1.y] != null) {
trace("ERROR: double book spot.");
}
Grid.setVar(_local1.x, _local1.y, _local1);
_local2++;
}
if (bCheckForEnd) {
rowsOccupied = Math.abs(_local3 - lowest);
rowsEmpty = rows - rowsOccupied;
EvaluateBoardStatus(rowsOccupied, rowsEmpty);
}
}
function onTileClick() {
if (paused || (!active)) {
return(false);
}
var _local1 = this._parent;
clickTile(_local1.tile.x, _local1.tile.y);
return(undefined);
}
function clickTile(iX, iY) {
var oTile = Grid.getVar(iX, iY);
switch (oTile.type) {
case NORMAL_TYPE :
if (!attemptClear(oTile)) {
return(false);
}
break;
DetonateBomb(oTile);
break;
DetonateColorBomb(oTile);
var CS = new CallStackClass(TweenInterval);
CS.append(disableMouse);
var aColumn;
var drop;
var iTop = Math.max(CurrentRow - Rows, 0);
var i = 0;
while (i < Columns) {
aColumn = Grid.grid[i];
drop = 0;
var _local3 = aColumn.length - 1;
while (_local3 >= iTop) {
if (aColumn[_local3] == null) {
drop++;
} else {
aColumn[_local3].y = aColumn[_local3].y + drop;
}
_local3--;
}
i++;
}
generateGrid();
var i = 0;
while (i < Median) {
if (Grid.grid[i] == null) {
var _local3 = i;
while (_local3 >= 0) {
var _local2 = Grid.grid[_local3 - 1];
Grid.grid[_local3] = _local2;
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1].x = _local2[_local1].x + 1;
_local1++;
}
_local3--;
}
}
i++;
}
var i = Columns;
while (i >= Median) {
if (Grid.grid[i] == null) {
var _local3 = i;
while (_local3 < Columns) {
var _local2 = Grid.grid[_local3 + 1];
Grid.grid[_local3] = _local2;
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1].x = _local2[_local1].x - 1;
_local1++;
}
_local3++;
}
}
i--;
}
generateGrid();
if (animationsEnabled) {
VerticalTween.skip();
HorizontalTween.skip();
VerticalTween = (T = new TweenClass());
GetTweenChangedVertical(T);
CS.append(T.start, T);
CS.append(T.update, T);
HorizontalTween = (T = new TweenClass());
GetTweenChangedHorizontal(T);
CS.append(T.start, T);
CS.append(T.update, T);
CS.append(deleteTweens);
} else {
var i = 0;
while (i < Tiles.length) {
Tiles[i].target._x = Tiles[i].x;
Tiles[i].target._y = Tiles[i].y;
i++;
}
}
CS.append(enableMouse);
CS.start();
return(true);
case INDESTRUCTIBLE_TYPE :
case BOMB_TYPE :
DetonateBomb(oTile);
break;
case COLORED_BOMB_TYPE :
DetonateColorBomb(oTile);
}
var CS = new CallStackClass(TweenInterval);
CS.append(disableMouse);
var aColumn;
var drop;
var iTop = Math.max(CurrentRow - Rows, 0);
var i = 0;
while (i < Columns) {
aColumn = Grid.grid[i];
drop = 0;
var _local3 = aColumn.length - 1;
while (_local3 >= iTop) {
if (aColumn[_local3] == null) {
drop++;
} else {
aColumn[_local3].y = aColumn[_local3].y + drop;
}
_local3--;
}
i++;
}
generateGrid();
var i = 0;
while (i < Median) {
if (Grid.grid[i] == null) {
var _local3 = i;
while (_local3 >= 0) {
var _local2 = Grid.grid[_local3 - 1];
Grid.grid[_local3] = _local2;
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1].x = _local2[_local1].x + 1;
_local1++;
}
_local3--;
}
}
i++;
}
var i = Columns;
while (i >= Median) {
if (Grid.grid[i] == null) {
var _local3 = i;
while (_local3 < Columns) {
var _local2 = Grid.grid[_local3 + 1];
Grid.grid[_local3] = _local2;
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1].x = _local2[_local1].x - 1;
_local1++;
}
_local3++;
}
}
i--;
}
generateGrid();
if (animationsEnabled) {
VerticalTween.skip();
HorizontalTween.skip();
VerticalTween = (T = new TweenClass());
GetTweenChangedVertical(T);
CS.append(T.start, T);
CS.append(T.update, T);
HorizontalTween = (T = new TweenClass());
GetTweenChangedHorizontal(T);
CS.append(T.start, T);
CS.append(T.update, T);
CS.append(deleteTweens);
} else {
var i = 0;
while (i < Tiles.length) {
Tiles[i].target._x = Tiles[i].x;
Tiles[i].target._y = Tiles[i].y;
i++;
}
}
CS.append(enableMouse);
CS.start();
return(true);
return(false);
}
function deleteTweens() {
delete VerticalTween;
delete HorizontalTween;
}
function detonateColorBomb(oTile) {
var _local2;
var iColor = oTile.color;
var _local3 = 0;
var _local1 = Tiles.length - 1;
while (_local1 >= 0) {
_local2 = Tiles[_local1];
if (_local2.color == iColor) {
Tiles.splice(_local1, 1);
Grid.setVar(_local2.x, _local2.y, null);
_local2.removeAsset();
_local3++;
}
_local1--;
}
SendEvent("onUseColorBomb", _local3, iColor);
}
function detonateBomb(oTile) {
var _local1;
var xspan;
var _local3;
var iX = oTile.x;
var iY = oTile.y;
var c = 0;
var _local2 = Tiles.length - 1;
while (_local2 >= 0) {
_local1 = Tiles[_local2];
xspan = _local1.x - iX;
_local3 = _local1.y - iY;
if (((xspan * xspan) + (_local3 * _local3)) < bombStrength2) {
c++;
Tiles.splice(_local2, 1);
Grid.setVar(_local1.x, _local1.y, null);
_local1.removeAsset();
}
_local2--;
}
SendEvent("onUseBomb", c);
}
function attemptClear(oTile) {
var _local1 = oTile;
var _local3 = getAdjacentColoredTiles(_local1.x, _local1.y, _local1.color);
if (_local3.length < mininumRequired) {
SendEvent("onIncompleteSet");
return(false);
}
var _local2 = 0;
while (_local2 < _local3.length) {
_local1 = _local3[_local2];
Grid.setVar(_local1.x, _local1.y, null);
_local1.removeAsset();
Tiles.remove(_local1);
_local2++;
}
SendEvent("onCompleteSet", _local3.length);
return(true);
}
function GetTweenChangedVertical(oTweenObject) {
var tTween;
var _local1;
var _local3;
var _local2 = 0;
while (_local2 < Tiles.length) {
_local1 = Tiles[_local2];
_local3 = _local1.y * CellHeight;
if (_local1.target._y != _local3) {
tTween = oTweenObject.createNewTween(_local1.target);
tTween.addPosition(TweenSpeed * Math.abs((_local1.target._y / CellHeight) - _local1.y), _local1.target._x, _local3);
}
_local2++;
}
return(tTween);
}
function GetTweenChangedHorizontal(oTweenObject) {
var tTween;
var _local1;
var _local3;
var _local2 = 0;
while (_local2 < Tiles.length) {
_local1 = Tiles[_local2];
_local3 = _local1.x * CellWidth;
nY = _local1.y * CellHeight;
if (_local1.target._x != _local3) {
tTween = oTweenObject.createNewTween(_local1.target);
tTween.addPosition(TweenSpeed, _local3, nY, _local1.target._x, nY);
}
_local2++;
}
return(tTween);
}
function getAdjacentColoredTiles(iX, iY, iColor) {
__tmpList__ = [];
__tmpGrid__ = new Grid2D();
__checkLocation(iX, iY, iColor);
aRet = __tmpList__;
delete __tmpGrid__;
delete __tmpList__;
return(aRet);
}
function __checkLocation(iX, iY, iColor) {
var _local2 = iY;
var _local3 = iX;
if (!__tmpGrid__.getVar(_local3, _local2)) {
var _local1 = Grid.getVar(_local3, _local2);
__tmpGrid__.setVar(_local3, _local2, 1);
if (_local1 == null) {
return(null);
}
if (_local1.color == iColor) {
__tmpList__.push(_local1);
__checkNeighbors(_local3, _local2, iColor);
}
}
return(undefined);
}
function __checkNeighbors(iX, iY, iColor) {
var _local1 = iColor;
var _local2 = iY;
var _local3 = iX;
__checkLocation(_local3, _local2 + 1, _local1);
__checkLocation(_local3, _local2 - 1, _local1);
__checkLocation(_local3 - 1, _local2, _local1);
__checkLocation(_local3 + 1, _local2, _local1);
}
function disableMouse() {
mouseEnabled = false;
}
function enableMouse() {
mouseEnabled = true;
}
function setTileRate(iMilliseconds) {
TileRate = Math.max(MinTileRate, iMilliseconds);
trace("Tile rate set to " + TileRate);
}
function getTileRate() {
return(TileRate);
}
function addTile(iType, iColor, iX, iY) {
var oTile = new Tile(mcGameArea.mcTiles, iType, iColor, iX, iY);
}
function generateRows(iRows) {
var _local1 = iRows * Columns;
while (_local1 > 0) {
_local1--;
addTile(1, getRandomColor(), _local1 % Columns, Math.floor(_local1 / Columns));
}
startRow = iRows;
generateGrid();
}
function insertRow(aPattern) {
var _local2 = aPattern;
if (_local2 == null) {
var _local1 = 0;
while (_local1 < columns) {
addTile(0, getRandomColor(), _local1, CurrentRow);
_local1++;
}
} else {
var _local1 = 0;
while (_local1 < columns) {
addTile(_local2[_local1].type, _local2[_local1].color, _local1, CurrentRow);
_local1++;
}
}
shiftRowsBy(1);
GenerateGrid(true);
}
function setColors(aColors) {
var _local2 = aColors;
colors = _local2;
colorCount = [];
var _local1 = 0;
while (_local1 < _local2.length) {
colorCount[_local1] = 0;
_local1++;
}
}
function getRandomColor() {
var _local2 = 0;
var _local3 = 0;
var lowest = totalTilesCreated;
var _local1 = 0;
while (_local1 < colors.length) {
_local2 = _local2 + (colorCount[_local1] + 1);
_local3 = Math.max(colorCount[_local1], _local3);
lowest = Math.min(colorCount[_local1], lowest);
_local1++;
}
var num = random(_local2);
_local2 = 0;
_local1 = 0;
while (_local1 < colors.length) {
_local2 = _local2 + (((_local3 - colorCount[_local1]) + lowest) + 1);
if (num < _local2) {
colorCount[_local1]++;
return(colors[_local1]);
}
_local1++;
}
num = random(colors.length);
colorCount[num]++;
return(colors[num]);
}
function shiftRowsBy(iShiftBy) {
CurrentRow = CurrentRow + iShiftBy;
var _local2 = new CallStackClass(TweenInterval);
_local2.append(disableMouse);
var _local1 = new TweenClass();
var _local3 = _local1.createNewTween(mcGameArea.mcTiles);
_local3.addPosition(TweenSpeed * Math.abs(iShiftBy), 0, ((-CurrentRow) + 1) * CellHeight);
_local2.append(_local1.start, _local1);
_local2.append(_local1.update, _local1);
_local2.append(enableMouse);
_local2.start(onCallStackDone);
}
function setToRow(iRow) {
mcGameArea.mcTiles._y = -iRow;
}
function getCurrentRow() {
return(-mcGameArea.mcTiles._y);
}
function start() {
ResetTileQueue();
setToRow(0);
shiftRowsBy(startRow);
resetOdds();
clearInterval(_level0._GM_UpdateInterval);
_level0._GM_UpdateInterval = setInterval(update, 10);
trace(_level0._GM_UpdateInterval);
active = true;
tileQuick = false;
}
function update() {
elapsed = getTimer() - lastTime;
lastTime = getTimer();
if ((paused || (!active)) || (!mouseEnabled)) {
return(null);
}
updateBuildBar();
}
function BuildBarPress() {
buildBarDown = true;
tileQuick = true;
}
function BuildBarRelease() {
buildBarDown = false;
}
function BuildBarRollOver() {
var _local1 = 0;
while (_local1 < columns) {
mcBuildBar["mc" + ((_local1 * 2) + 1)].gotoAndStop("over");
_local1++;
}
}
function BuildBarRollOut() {
var _local1 = 0;
while (_local1 < columns) {
mcBuildBar["mc" + ((_local1 * 2) + 1)].gotoAndStop("up");
_local1++;
}
}
function resetTileQueue() {
TileQueue = [];
TileQueueCount = 0;
}
function resetOdds() {
bombCounter = bombOdds;
colorBombCounter = colorBombOdds;
IndestructiblesCounter = IndestructiblesOdds;
}
function shiftOdds() {
bombCounter = Math.max(--bombCounter, minOdds);
colorBombCounter = Math.max(--colorBombCounter, minOdds);
IndestructiblesCounter = Math.max(--IndestructiblesCounter, minOdds);
}
function updateBuildBar() {
tileTimeRemaining = tileTimeRemaining - elapsed;
if ((tileTimeRemaining <= 0) || (tileQuick)) {
var _local1;
var _local3;
var c;
var bmb;
var cbmb;
var ind;
tileTimeRemaining = tileRate;
if (((TileQueue == null) || (TileQueue.length == 0)) || (TileQueueCount == 0)) {
resetTileQueue();
var _local2 = 0;
while (_local2 < Columns) {
shiftOdds();
if (useBombs) {
bmb = random(bombCounter);
}
if (useColorBombs) {
cbmb = random(colorBombCounter);
}
if (useIndestructibles) {
ind = random(IndestructiblesCounter);
}
_local1 = (TileQueue[_local2] = {});
if (bmb == 0) {
_local1.type = BOMB_TYPE;
} else if (cbmb == 0) {
_local1.type = COLORED_BOMB_TYPE;
} else if (ind == 0) {
_local1.type = INDESTRUCTIBLE_TYPE;
} else {
_local1.type = NORMAL_TYPE;
}
if (_local1.type != NORMAL_TYPE) {
resetOdds();
}
switch (_local1.type) {
case NORMAL_TYPE :
case COLORED_BOMB_TYPE :
_local1.color = getRandomColor();
break;
case BOMB_TYPE :
_local1.color = GenericBombColor;
break;
case INDESTRUCTIBLE_TYPE :
_local1.color = IndestructibleColor;
}
_local3 = (_local1.target = mcBuildBar["mc" + (_local2 * 2)]);
_local3.gotoAndStop(_local1.type);
_local3.mcSymbol.gotoAndStop(_local1.color);
_local2++;
}
}
TileQueue[Number(TileQueueCount)].target._visible = true;
if (TileQueueCount >= Columns) {
insertRow(TileQueue);
TileQueueCount = 0;
var _local2 = 0;
while (_local2 < Columns) {
TileQueue[_local2].target._visible = false;
_local2++;
}
tileQuick = false;
SendEvent("onRowAdded", CurrentRow);
return(null);
}
SendEvent("onTileQueued", TileQueueCount);
TileQueueCount++;
updateAfterEvent();
}
return(undefined);
}
function onCallStackDone(oRef) {
}
function pause() {
mcBuildBar._visible = (mcGameArea.mcTiles._visible = false);
paused = true;
}
function unpause() {
mcBuildBar._visible = (mcGameArea.mcTiles._visible = true);
paused = false;
}
function setSize(iColumns, iRows, iCellHeight, iCellWidth) {
reset();
rows = ((iRows == null) ? 20 : (iRows));
columns = ((iColumns == null) ? 10 : (iColumns));
cellWidth = ((iCellWidth == null) ? 20 : (iCellWidth));
cellHeight = ((iCellHeight == null) ? 20 : (iCellHeight));
median = Math.floor(Columns * 0.5);
mcMask._xscale = (mcArea._xscale = columns * cellWidth);
mcMask._yscale = (mcArea._yscale = (rows + 1) * cellHeight);
mcGameArea._y = (rows - 1) * cellHeight;
createBuildBar();
sendEvent("onResize");
}
function createBuildBar() {
var mc;
var _local2;
var _local3;
mcBuildBar.removeMovieClip();
createEmptyMovieClip("mcBuildBar", 30);
var _local1 = 0;
while (_local1 < columns) {
_local2 = _local1 * 2;
_local3 = _local2 + 1;
mcBuildBar.attachMovie(tileLinkageName, "mc" + _local2, _local2);
mcBuildBar.attachMovie(buildBarCellName, "mc" + _local3, _local3);
mcA = mcBuildBar["mc" + _local2];
mcB = mcBuildBar["mc" + _local3];
mcB._x = (mcA._x = _local1 * CellWidth);
mcA._visible = false;
_local1++;
}
mcBuildBar._y = CellHeight * Rows;
}
NORMAL_TYPE = 1;
INDESTRUCTIBLE_TYPE = 2;
BOMB_TYPE = 2;
COLORED_BOMB_TYPE = 4;
active = false;
paused = false;
canPause = false;
animationsEnabled = true;
mouseEnabled = false;
tileLinkageName = "tile";
buildBarCellName = "buildbarCell";
mininumRequired = 3;
warningRows = 3;
TweenSpeed = 0.05;
TweenInterval = 10;
MinTileRate = 30;
useBombs = false;
bombOdds = 1000;
bombStrength = 4;
useColorBombs = false;
colorBombOdds = 1000;
useIndestructibles = false;
indestructiblesOdds = 1000;
GenericBombColor = 1;
IndestructibleColor = 1;
bombStrength2 = bombStrength * bombStrength;
rowsEmpty = 0;
colorBombCounter = 0;
bombCounter = 0;
IndestructibleCounter = 0;
minOdds = 10;
CallStacks = [];
attachMovie("square", "mcMask", 1000);
setMask(mcMask);
mcArea._visible = false;
Tile.prototype.moveTo = function (iX, iY) {
var _local1 = this;
_local1.target._x = ((_local1.x = iX)) * CellWidth;
_local1.target._y = ((_local1.y = iY)) * CellHeight;
};
Tile.prototype.removeAsset = function () {
this.target.removeMovieClip();
};
var __tmpGrid__;
var __tmpList__;
sendEvent("onGameReady");
Symbol 188 MovieClip Frame 1
stop();
Symbol 196 MovieClip Frame 1
function setTime(iSeconds) {
var _local1 = iSeconds;
var _local3;
var mChanged;
var _local2;
if (_local1 >= 60) {
mChanged = Minutes != ((Minutes = Math.floor(_local1 / 60)));
} else {
_local2 = Tenths != ((Tenths = Math.floor((_local1 % 1) * 10)));
}
_local3 = Seconds != ((Seconds = Math.floor(_local1) % 60));
if (_local3 || (_local2)) {
if (_local1 > 60) {
Time = ((Minutes + ":") + ((Seconds < 10) ? "0" : "")) + Seconds;
} else {
Time = ((Seconds + ".<FONT size=\"16px\">") + Tenths) + "</FONT>";
}
if (_local1 > 20) {
sTime = ("<P align=\"center\">" + Time) + "</P>";
} else if (_local1 > 10) {
sTime = ("<P align=\"center\"><FONT color=\"#FEF441\">" + Time) + "</FONT></P>";
} else {
sTime = (((Tenths % 5) <= 1) ? (("<P align=\"center\"><FONT color=\"#FEF441\">" + Time) + "</FONT></P>") : "");
}
_local2 = false;
_local3 = false;
}
}
function setLevel(iLevel) {
level = iLevel;
}
function setScore(iScore, bCountup, fSeconds) {
var _local1 = iScore;
if (bCountup) {
targetScore = _local1;
targetTimeRemaining = fSeconds;
incrementPerSecond = (_local1 - score) / fSeconds;
lastTime = getTimer() * 0.001;
if (ScoreCountInterval == null) {
ScoreCountInterval = setInterval(incrementScore, ScoreCountInt);
}
} else {
score = _local1;
}
}
function incrementScore() {
var _local1 = (-LastTime) + ((LastTime = getTimer() * 0.001));
targetTimeRemaining = targetTimeRemaining - _local1;
Score = int(Score + (incrementPerSecond * _local1));
if (targetTimeRemaining <= 0) {
Score = targetScore;
clearInterval(ScoreCountInterval);
ScoreCountInterval = null;
}
updateAfterEvent();
}
var ScoreCountInt = 40;
Symbol 199 Button
on (release) {
ShowMenu();
}
Symbol 206 MovieClip Frame 1
stop();
Symbol 206 MovieClip Frame 2
stop();
Symbol 206 MovieClip Frame 3
stop();
Symbol 206 MovieClip Frame 4
stop();
Symbol 219 Button
on (release) {
_parent.ShowQuit();
}
Symbol 220 Button
on (release) {
_parent.ShowHelp(false);
}
Symbol 229 Button
on (release) {
_parent.cancelDialog();
}
Symbol 236 MovieClip Frame 1
function setTime(iSeconds) {
var _local1 = iSeconds;
var _local3;
var mChanged;
var _local2;
if (_local1 >= 60) {
mChanged = Minutes != ((Minutes = Math.floor(_local1 / 60)));
} else {
_local2 = Tenths != ((Tenths = Math.floor((_local1 % 1) * 10)));
}
_local3 = Seconds != ((Seconds = Math.floor(_local1) % 60));
if (_local3 || (_local2)) {
if (_local1 > 60) {
Time = ((Minutes + ":") + ((Seconds < 10) ? "0" : "")) + Seconds;
} else {
Time = ((Seconds + ".<FONT size=\"16px\">") + Tenths) + "</FONT>";
}
if (_local1 > 20) {
sTime = ("<P align=\"center\">" + Time) + "</P>";
} else if (_local1 > 10) {
sTime = ("<P align=\"center\"><FONT color=\"#FF4444\">" + Time) + "</FONT></P>";
} else {
sTime = (((Tenths % 5) <= 1) ? (("<P align=\"center\"><FONT color=\"#FF4444\">" + Time) + "</FONT></P>") : "");
}
_local2 = false;
_local3 = false;
}
}
function setLevel(iLevel) {
level = iLevel;
}
function setScore(iScore, bCountup, fSeconds) {
var _local1 = iScore;
if (bCountup) {
targetScore = _local1;
targetTimeRemaining = fSeconds;
incrementPerSecond = (_local1 - score) / fSeconds;
lastTime = getTimer() * 0.001;
if (ScoreCountInterval == null) {
ScoreCountInterval = setInterval(incrementScore, ScoreCountInt);
}
} else {
score = _local1;
}
}
function incrementScore() {
var _local1 = (-LastTime) + ((LastTime = getTimer() * 0.001));
targetTimeRemaining = targetTimeRemaining - _local1;
Score = int(Score + (incrementPerSecond * _local1));
if (targetTimeRemaining <= 0) {
Score = targetScore;
clearInterval(ScoreCountInterval);
ScoreCountInterval = null;
}
updateAfterEvent();
}
var ScoreCountInt = 40;
Symbol 245 Button
on (release) {
_parent.startNewGame();
_parent.hideQuit();
}
Symbol 250 Button
on (release) {
_parent.SubmitScore();
}
Symbol 256 Button
on (release) {
_parent.cancelDialog();
}
Symbol 259 MovieClip Frame 1
function hideDialog() {
_visible = false;
gotoAndStop (2);
}
function showDialog(sName) {
gotoAndStop(sName);
_visible = true;
}
btn.useHandCursor = false;
stop();
Symbol 259 MovieClip Frame 19
stop();
Symbol 259 MovieClip Frame 24
mcScoreBox.score.text = _parent.score;
Symbol 259 MovieClip Frame 30
mcScoreBox.score.text = _parent.score;
Symbol 261 Button
on (release) {
_parent.StartNewGame();
}
Symbol 274 MovieClip Frame 17
stop();
Instance of Symbol 272 MovieClip "makerbutton" in Symbol 274 MovieClip Frame 17
onClipEvent (enterFrame) {
_rotation = (_rotation - 8);
}