Frame 1
function tmp(mc_mc, nextFr, pauseFr) {
var maxFr = 6;
if (pauseFr != undefined) {
var pauseFrames = pauseFr;
} else {
var pauseFrames = 0;
}
var isChanged = false;
mc_mc.play();
mc_mc.onEnterFrame = function () {
if ((this._currentframe == maxFr) && (!isChanged)) {
_root.gotoAndStop(nextFr);
mc_mc.stop();
isChanged = true;
} else if ((this._currentframe == maxFr) && (isChanged)) {
pauseFrames--;
} else if (this._currentframe == this._totalframes) {
this.gotoAndStop(1);
delete this.onEnterFrame;
}
if (pauseFrames <= 0) {
mc_mc.play();
pauseFrames = undefined;
}
};
}
var total = getBytesTotal();
var loaded = null;
var soundFold = "sounds/";
var add_sound = new Sound();
var expl_sound = new Sound();
var bonus_sound = new Sound();
var none_sound = new Sound();
var dis_sound = new Sound();
var fall_sound = new Sound();
var menuClick_sound = new Sound();
var menuEnt_sound = new Sound();
var bg_sound = new Sound();
var vol = 80;
var sndOn = true;
add_sound.setVolume(vol);
expl_sound.setVolume(vol);
bonus_sound.setVolume(vol);
none_sound.setVolume(vol);
dis_sound.setVolume(vol);
fall_sound.setVolume(vol);
menuClick_sound.setVolume(vol);
menuEnt_sound.setVolume(vol);
bg_sound.setVolume(vol);
tmp_mc.swapDepths(100000);
add_sound.attachSound("add");
expl_sound.attachSound("explosion");
bonus_sound.attachSound("bonus_snd");
none_sound.attachSound("none_snd");
dis_sound.attachSound("gemfall");
fall_sound.attachSound("gemout");
menuClick_sound.attachSound("menuClick");
menuEnt_sound.attachSound("menuEnter");
bg_sound.attachSound("gemzone");
per_txt.embedFonts = true;
per1_txt.embedFonts = true;
onEnterFrame = function () {
loaded = getBytesLoaded();
bar_mc.gotoAndStop(Math.floor((loaded / total) * 100));
per_txt.text = Math.floor((loaded / total) * 100) + "%";
per1_txt.text = Math.floor((loaded / total) * 100) + "%";
if (Math.floor(loaded / total) == 1) {
delete this.onEnterFrame;
tmp(tmp_mc, 3);
}
};
Stage.showMenu = false;
Frame 2
logo_mc.onPress = function () {
getURL ("http://www.justfreegames.com", "_blank");
};
stop();
Frame 3
stop();
menu_mc.arrow_mc._y = 1_mc._y - 9;
var punktName = "";
var i = 1;
while (i <= 3) {
punktName = ("menu_mc." + i) + "_mc";
eval (punktName).gotoAndStop(1);
eval (punktName).onRollOver = function () {
if (menu_mc.arrow_mc._y != (this._y - 9)) {
menu_mc.arrow_mc._y = this._y - 9;
menuClick_sound.start(0, 1);
}
var j = 1;
while (j <= 3) {
punktNameTmp = ("menu_mc." + j) + "_mc";
eval (punktNameTmp).gotoAndStop(1);
j++;
}
this.play();
};
eval (punktName).onPress = function () {
menuEnt_sound.start(0, 1);
switch (this._name) {
case "1_mc" :
tmp(tmp_mc, 4);
break;
case "2_mc" :
tmp(tmp_mc, 5);
break;
case "3_mc" :
getURL ("http://www.justfreegames.com?r1=F&r2=GM&WT.mc_id=FlashGM", "_blank");
}
};
i++;
}
menu_mc.onEnterFrame = function () {
if (tmp_mc._currentframe != 1) {
var i = 1;
while (i <= 3) {
eval (("menu_mc." + i) + "_mc").enabled = false;
i++;
}
} else {
var i = 1;
while (i <= 3) {
eval (((this + ".") + i) + "_mc").enabled = true;
i++;
}
}
};
if (bg_sound.position == 0) {
bg_sound.start(0, 1000000);
}
Instance of Symbol 99 MovieClip in Frame 3
on (press) {
_root.sndOn = !_root.sndOn;
if (_root.sndOn) {
_root.add_sound.setVolume(_root.vol);
_root.expl_sound.setVolume(_root.vol);
_root.bonus_sound.setVolume(_root.vol);
_root.none_sound.setVolume(_root.vol);
_root.dis_sound.setVolume(_root.vol);
_root.fall_sound.setVolume(_root.vol);
_root.menuClick_sound.setVolume(_root.vol);
_root.menuEnt_sound.setVolume(_root.vol);
_root.bg_sound.setVolume(_root.vol);
gotoAndStop (1);
} else {
_root.add_sound.setVolume(0);
_root.expl_sound.setVolume(0);
_root.bonus_sound.setVolume(0);
_root.none_sound.setVolume(0);
_root.dis_sound.setVolume(0);
_root.fall_sound.setVolume(0);
_root.menuClick_sound.setVolume(0);
_root.menuEnt_sound.setVolume(0);
_root.bg_sound.setVolume(0);
gotoAndStop (2);
}
}
Frame 4
stop();
fields_mc.level_txt.embedFonts = true;
fields_mc.lines_txt.embedFonts = true;
fields_mc.points_txt.embedFonts = true;
win_mc.level_txt.text = gems_mc.level + 1;
createEmptyMovieClip("btnPause_mc", 200000);
btnPause_mc.attachMovie("tmp", "btn", 0);
btnPause_mc.useHandCursor = false;
btnPause_mc.onPress = function () {
this.removeMovieClip();
win_mc._visible = false;
gems_mc.generateStringStart();
};
up_btn.useHandCursor = false;
up_btn.onPress = function () {
up_btn.enabled = false;
gems_mc.up(gems_mc.genArr);
};
gems.swapDepths(tmp_mc.getDepth() - 10);
win_mc.swapDepths(gems.getDepth() + 100);
Frame 5
btn_mc.useHandCursor = false;
btn_mc.onPress = function () {
tmp(tmp_mc, 3);
};
Symbol 21 MovieClip [b0] Frame 5
stop();
Symbol 21 MovieClip [b0] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 25 MovieClip [expl] Frame 14
this.removeMovieClip();
Symbol 28 MovieClip [b5] Frame 5
stop();
Symbol 28 MovieClip [b5] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 31 MovieClip [b4] Frame 5
stop();
Symbol 31 MovieClip [b4] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 34 MovieClip [b3] Frame 5
stop();
Symbol 34 MovieClip [b3] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 37 MovieClip [b2] Frame 5
stop();
Symbol 37 MovieClip [b2] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 40 MovieClip [b1] Frame 5
stop();
Symbol 40 MovieClip [b1] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 44 MovieClip [tmp] Frame 1
stop();
Symbol 50 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 2
stop();
Symbol 107 MovieClip [stars] Frame 28
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 109 MovieClip [bonus] Frame 10
stop();
this.swapDepths(4747);
this.removeMovieClip();
Symbol 110 MovieClip [grid] Frame 1
#initclip 1
GridClass = function () {
this.drawGrid(this.step, this.XSteps, this.YSteps, this.X, this.Y, this.gridColor);
};
GridClass.prototype.step = 23;
GridClass.prototype.XSteps = 12;
GridClass.prototype.YSteps = 15;
GridClass.prototype.X = 222;
GridClass.prototype.Y = 13;
GridClass.prototype.gridColor = 11842740 /* 0xB4B4B4 */;
GridClass.prototype.drawGrid = function (step, XSteps, YSteps, X, Y, gridColor) {
createEmptyMovieClip("grid", 0);
grid.lineStyle(0, gridColor, 0);
grid.moveTo(X, Y);
grid.lineTo(X + (step * XSteps), Y);
grid.lineTo(X + (step * XSteps), Y + (step * YSteps));
grid.lineTo(X, Y + (step * YSteps));
grid.lineTo(X, Y);
var i = 1;
while (i < XSteps) {
grid.moveTo(X + (step * i), Y);
grid.lineTo(X + (step * i), Y + (step * YSteps));
i++;
}
var i = 1;
while (i < YSteps) {
grid.moveTo(X, Y + (step * i));
grid.lineTo(X + (step * XSteps), Y + (step * i));
i++;
}
var YCoord = 1;
var placeName = "";
var superClass = this;
var i = YSteps;
while (i >= 1) {
var j = XSteps;
while (j >= 1) {
grid.attachMovie("place", (("place_X" + j) + "Y") + YCoord, grid.getNextHighestDepth());
placeName = (("grid.place_X" + j) + "Y") + YCoord;
eval (placeName)._x = X + ((j - 1) * step);
eval (placeName)._y = Y + ((i - 1) * step);
eval (placeName)._width = step;
eval (placeName)._height = step;
eval (placeName)._alpha = 0;
eval (placeName).X = j;
eval (placeName).Y = YCoord;
eval (placeName).gem = "none";
eval (placeName).gemType = 0;
eval (placeName).useHandCursor = false;
eval (placeName).onPress = function () {
superClass.gemPress(this);
};
j--;
}
YCoord++;
i--;
}
};
GridClass.prototype.gemPress = function (place_mc) {
if ((place_mc.gem != "none") && (((((place_mc.gemType == "1") || (place_mc.gemType == "2")) || (place_mc.gemType == "3")) || (place_mc.gemType == "4")) || (place_mc.gemType == "5"))) {
var searchArr = this.search(place_mc);
}
var Xmin = Infinity;
var Xmax = (-Infinity);
if (place_mc.gem == "none") {
return(undefined);
}
if ((((((place_mc.gemType == "b0") || (place_mc.gemType == "b1")) || (place_mc.gemType == "b2")) || (place_mc.gemType == "b3")) || (place_mc.gemType == "b4")) || (place_mc.gemType == "b5")) {
_root.expl_sound.start(0, 1);
if (place_mc.gemType == "b0") {
this.explosive(false, place_mc);
} else {
this.explosive(true, place_mc);
}
return(undefined);
}
if ((searchArr.length < 3) || (place_mc.gemType == "6")) {
_root.none_sound.start(0, 1);
return(undefined);
}
fields_mc.points_txt.text = Number(fields_mc.points_txt.text) + ((1 + (0.5 * (searchArr.length - 3))) * searchArr.length);
var i = 0;
while (i < searchArr.length) {
Xmin = Math.min(Xmin, searchArr[i].X);
Xmax = Math.max(Xmax, searchArr[i].X);
this.disappear(eval (searchArr[i].gem));
searchArr[i].gem = "none";
searchArr[i].gemType = 0;
i++;
}
_root.dis_sound.start(0, 1);
this.falling(Xmin, Xmax);
};
GridClass.prototype.explosive = function (isColorBomb, place_mc) {
var placeName = "";
var place = null;
var placesArr = new Array();
var gemType = "";
if (isColorBomb) {
gemType = place_mc.gemType.substr(1);
var x = 1;
while (x <= grid_mc.XSteps) {
var y = 1;
while (y <= grid_mc.YSteps) {
placeName = (("grid.place_X" + x) + "Y") + y;
place = eval (placeName);
if ((place.gemType == gemType) || (place.gemType == place_mc.gemType)) {
placesArr.push(place);
}
y++;
}
x++;
}
} else {
placeName = (("grid.place_X" + (place_mc.X - 1)) + "Y") + place_mc.Y;
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + (place_mc.X - 1)) + "Y") + (place_mc.Y + 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + place_mc.X) + "Y") + (place_mc.Y + 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + (place_mc.X + 1)) + "Y") + (place_mc.Y + 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + (place_mc.X + 1)) + "Y") + place_mc.Y;
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + (place_mc.X + 1)) + "Y") + (place_mc.Y - 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + place_mc.X) + "Y") + (place_mc.Y - 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
placeName = (("grid.place_X" + (place_mc.X - 1)) + "Y") + (place_mc.Y - 1);
place = eval (placeName);
if (place != undefined) {
placesArr.push(place);
}
}
if (expl_mc == undefined) {
createEmptyMovieClip("expl_mc", getNextHighestDepth());
}
var ind = 0;
eval (place_mc.gem).gotoAndPlay(5);
place_mc.gem = "none";
place_mc.gemType = "0";
expl_mc.attachMovie("expl", "expl" + ind, ind);
eval ("expl_mc.expl" + ind)._x = place_mc._x;
eval ("expl_mc.expl" + ind)._y = place_mc._y;
ind++;
eval (place_mc.gem).onEnterFrame = function () {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
delete this.onEnterFrame;
}
};
var i = 0;
while (i < placesArr.length) {
eval (placesArr[i].gem).gotoAndPlay(5);
placesArr[i].gem = "none";
placesArr[i].gemType = "0";
expl_mc.attachMovie("expl", "expl" + ind, ind);
eval ("expl_mc.expl" + ind)._x = placesArr[i]._x;
eval ("expl_mc.expl" + ind)._y = placesArr[i]._y;
ind++;
eval (placesArr[i]).onEnterFrame = function () {
if (eval (this.gem)._currentframe == eval (this.gem)._totalframes) {
eval (this.gem).removeMovieClip();
delete this.onEnterFrame;
}
};
i++;
}
if (!isColorBomb) {
this.falling(place_mc.X - 1, place_mc.X + 1);
} else {
this.falling(1, grid_mc.XSteps);
}
};
GridClass.prototype.search = function (place_mc) {
if (place_mc.gem == "none") {
mc_array = new Array();
return(mc_array);
}
var mc_array = new Array(place_mc);
var searchPlaceName = "";
var i = 0;
while (i < mc_array.length) {
var j = 1;
while (j <= 4) {
if ((j == 1) && (place_mc.X > 1)) {
searchPlaceName = (("grid.place_X" + (mc_array[i].X - 1)) + "Y") + mc_array[i].Y;
if ((((((((eval (searchPlaceName).gemType == mc_array[0].gemType) || (eval (searchPlaceName).gemType == "b0")) || (eval (searchPlaceName).gemType == "b1")) || (eval (searchPlaceName).gemType == "b2")) || (eval (searchPlaceName).gemType == "b3")) || (eval (searchPlaceName).gemType == "b4")) || (eval (searchPlaceName).gemType == "b5")) && (mc_array.join(" ").indexOf(searchPlaceName) == -1)) {
mc_array.push(eval (searchPlaceName));
}
} else if ((j == 2) && (place_mc.Y < grid_mc.YSteps)) {
searchPlaceName = (("grid.place_X" + mc_array[i].X) + "Y") + (mc_array[i].Y + 1);
if ((((((((eval (searchPlaceName).gemType == mc_array[0].gemType) || (eval (searchPlaceName).gemType == "b0")) || (eval (searchPlaceName).gemType == "b1")) || (eval (searchPlaceName).gemType == "b2")) || (eval (searchPlaceName).gemType == "b3")) || (eval (searchPlaceName).gemType == "b4")) || (eval (searchPlaceName).gemType == "b5")) && (mc_array.join(" ").indexOf(searchPlaceName) == -1)) {
mc_array.push(eval (searchPlaceName));
}
} else if ((j == 3) && (place_mc.X < grid_mc.XSteps)) {
searchPlaceName = (("grid.place_X" + (mc_array[i].X + 1)) + "Y") + mc_array[i].Y;
if ((((((((eval (searchPlaceName).gemType == mc_array[0].gemType) || (eval (searchPlaceName).gemType == "b0")) || (eval (searchPlaceName).gemType == "b1")) || (eval (searchPlaceName).gemType == "b2")) || (eval (searchPlaceName).gemType == "b3")) || (eval (searchPlaceName).gemType == "b4")) || (eval (searchPlaceName).gemType == "b5")) && (mc_array.join(" ").indexOf(searchPlaceName) == -1)) {
mc_array.push(eval (searchPlaceName));
}
} else if ((j == 4) && (place_mc.Y > 1)) {
searchPlaceName = (("grid.place_X" + mc_array[i].X) + "Y") + (mc_array[i].Y - 1);
if ((((((((eval (searchPlaceName).gemType == mc_array[0].gemType) || (eval (searchPlaceName).gemType == "b0")) || (eval (searchPlaceName).gemType == "b1")) || (eval (searchPlaceName).gemType == "b2")) || (eval (searchPlaceName).gemType == "b3")) || (eval (searchPlaceName).gemType == "b4")) || (eval (searchPlaceName).gemType == "b5")) && (mc_array.join(" ").indexOf(searchPlaceName) == -1)) {
mc_array.push(eval (searchPlaceName));
}
}
j++;
}
i++;
}
return(mc_array);
};
GridClass.prototype.disappear = function (mc_mc) {
mc_mc.swapDepths(mc_mc.getDepth() + 1000);
var k = ((mc_mc._y - target_mc._y) / (mc_mc._x - target_mc._x));
var b = (mc_mc._y - (k * mc_mc._x));
var alpha = ((20 * Math.random()) + 30);
var znak = Math.random();
if (znak < 0.5) {
znak = -1;
} else {
znak = 1;
}
mc_mc.onEnterFrame = function () {
mc_mc._rotation = alpha * znak;
mc_mc._x = mc_mc._x - 20;
mc_mc._y = (k * mc_mc._x) + b;
if ((mc_mc._x - target_mc._x) < 10) {
mc_mc._alpha = mc_mc._x - target_mc._x;
}
if (mc_mc._alpha <= 0) {
mc_mc.removeMovieClip();
}
};
};
GridClass.prototype.falling = function (Xmin, Xmax) {
var placeName = "";
var searchPlaceName = "";
var steps = null;
var This = this;
var i = 1;
while (i <= grid_mc.YSteps) {
var j = Xmin;
while (j <= Xmax) {
steps = 0;
placeName = (("grid.place_X" + j) + "Y") + i;
if (eval (placeName).gem == "none") {
var k = i;
while (k <= grid_mc.YSteps) {
searchPlaceName = (("grid.place_X" + j) + "Y") + k;
if (eval (searchPlaceName).gem != "none") {
gems_mc.enableGems(false);
this.fall(eval (searchPlaceName), steps);
steps = 0;
break;
}
steps++;
k++;
}
}
j++;
}
i++;
}
grid.onEnterFrame = function () {
var _local2 = This.checkOnEnterFrame();
if (!_local2) {
gems_mc.enableGems(true);
_local2 = true;
delete this.onEnterFrame;
This.toCenter();
}
};
};
GridClass.prototype.fall = function (mc_mc, steps) {
var newPlaceName = ((("grid.place_X" + mc_mc.X) + "Y") + (mc_mc.Y - steps));
var t = 1;
var g = 1;
var s = 0;
var v0 = 5;
var This = this;
eval (newPlaceName).gem = mc_mc.gem;
eval (newPlaceName).gemType = mc_mc.gemType;
mc_mc.gem = "none";
mc_mc.gemType = 0;
var finishY = (eval (eval (newPlaceName).gem)._y + (steps * grid_mc.step));
eval (eval (newPlaceName).gem).onEnterFrame = function () {
s = (v0 * t) + (((g * t) * t) / 2);
if ((finishY - eval (eval (newPlaceName).gem)._y) > s) {
eval (eval (newPlaceName).gem)._y = eval (eval (newPlaceName).gem)._y + s;
t++;
} else {
eval (eval (newPlaceName).gem)._y = finishY;
fall_sound.start(0, 1);
delete this.onEnterFrame;
}
};
};
GridClass.prototype.toCenter = function () {
var isOK = false;
var left = Math.floor(grid_mc.XSteps / 2);
var placeName = "";
var searchPlaceName = "";
var steps = null;
var This = this;
var j = left;
while (j >= 1) {
steps = 0;
var i = 1;
while (i <= grid_mc.YSteps) {
placeName = (("grid.place_X" + j) + "Y") + i;
if (eval (placeName).gem != "none") {
isOK = false;
break;
}
isOK = true;
i++;
}
if (isOK) {
isOK = false;
var m = j;
while (m >= 1) {
searchPlaceName = (("grid.place_X" + m) + "Y") + 1;
if (eval (searchPlaceName).gem != "none") {
break;
}
steps++;
m--;
}
var k = 1;
while (k <= grid_mc.YSteps) {
var n = j;
while (n >= m) {
searchPlaceName = (("grid.place_X" + n) + "Y") + k;
if (eval (searchPlaceName).gem != "none") {
this.Move(eval (searchPlaceName), steps, "left");
break;
}
n--;
}
k++;
}
steps = 0;
}
j--;
}
isOK = false;
placeName = "";
searchPlaceName = "";
steps = null;
var j = (left + 1);
while (j <= grid_mc.XSteps) {
steps = 0;
var i = 1;
while (i <= grid_mc.YSteps) {
placeName = (("grid.place_X" + j) + "Y") + i;
if (eval (placeName).gem != "none") {
isOK = false;
break;
}
isOK = true;
i++;
}
if (isOK) {
isOK = false;
var m = j;
while (m <= grid_mc.XSteps) {
searchPlaceName = (("grid.place_X" + m) + "Y") + 1;
if (eval (searchPlaceName).gem != "none") {
break;
}
steps++;
m++;
}
var k = 1;
while (k <= grid_mc.YSteps) {
var n = j;
while (n <= m) {
searchPlaceName = (("grid.place_X" + n) + "Y") + k;
if (eval (searchPlaceName).gem != "none") {
this.Move(eval (searchPlaceName), steps, "right");
break;
}
n++;
}
k++;
}
steps = 0;
}
j++;
}
};
GridClass.prototype.Move = function (mc_mc, steps, type) {
if (type == "left") {
var newPlaceName = ((("grid.place_X" + (mc_mc.X + steps)) + "Y") + mc_mc.Y);
} else if (type == "right") {
var newPlaceName = ((("grid.place_X" + (mc_mc.X - steps)) + "Y") + mc_mc.Y);
}
var s = 13;
var This = this;
eval (newPlaceName).gem = mc_mc.gem;
eval (newPlaceName).gemType = mc_mc.gemType;
mc_mc.gem = "none";
mc_mc.gemType = 0;
if (type == "left") {
var finishY = (eval (eval (newPlaceName).gem)._x + (steps * grid_mc.step));
eval (eval (newPlaceName).gem).onEnterFrame = function () {
if ((finishY - eval (eval (newPlaceName).gem)._x) > s) {
eval (eval (newPlaceName).gem)._x = eval (eval (newPlaceName).gem)._x + s;
} else {
eval (eval (newPlaceName).gem)._x = finishY;
delete this.onEnterFrame;
}
};
} else if (type == "right") {
var newPlaceName = ((("grid.place_X" + (mc_mc.X - steps)) + "Y") + mc_mc.Y);
var finishY = (eval (eval (newPlaceName).gem)._x - (steps * grid_mc.step));
eval (eval (newPlaceName).gem).onEnterFrame = function () {
if ((eval (eval (newPlaceName).gem)._x - finishY) > s) {
eval (eval (newPlaceName).gem)._x = eval (eval (newPlaceName).gem)._x - s;
} else {
eval (eval (newPlaceName).gem)._x = finishY;
delete this.onEnterFrame;
}
};
}
};
GridClass.prototype.checkOnEnterFrame = function () {
var placeName = "";
var gemName = "";
var gem_mc = undefined;
var x = 1;
while (x <= grid_mc.XSteps) {
var y = 1;
while (y <= grid_mc.YSteps) {
placeName = (("grid.place_X" + x) + "Y") + y;
gemName = eval (placeName).gem;
if (gemName == "none") {
break;
}
gem_mc = eval (gemName);
if (gem_mc.onEnterFrame != undefined) {
return(true);
}
y++;
}
x++;
}
return(false);
};
GridClass.prototype.clearField = function () {
var placeName = "";
var ind = 0;
var counter = 1;
var placeArr = new Array();
var colorArray = new Array("0x4CA4E5", "0x63B570", "0xFD9DFF", "0xFF0000", "0xFFFF00");
var curColorInd = 0;
var isBonus = true;
gems_mc.newID = 0;
gems_mc.enableGems(false);
var y = grid_mc.YSteps;
while (y >= 1) {
var x = 1;
while (x <= grid_mc.XSteps) {
placeName = (("grid.place_X" + x) + "Y") + y;
placeArr.push(eval (placeName));
x++;
}
y--;
}
createEmptyMovieClip("clear_mc", 474774);
clear_mc.onEnterFrame = function () {
counter++;
if (placeArr[ind].gem == "none") {
curColorInd = Math.round(4 * Math.random());
} else {
isBonus = false;
curColorInd = placeArr[ind].gemType - 1;
eval (placeArr[ind].gem).gotoAndPlay(5);
placeArr[ind].gem = "none";
placeArr[ind].gemType = 0;
}
clear_mc.attachMovie("stars", "stars" + ind, ind + 100000);
var col = new Color(eval ("clear_mc.stars" + ind));
col.setRGB(colorArray[curColorInd]);
eval ("clear_mc.stars" + ind)._x = placeArr[ind]._x;
eval ("clear_mc.stars" + ind)._y = placeArr[ind]._y;
ind++;
if (counter == grid_mc.XSteps) {
if (isBonus) {
bonus_sound.start(0, 1);
clear_mc.attachMovie("bonus", "bonus", getNextHighestDepth());
clear_mc.bonus._x = placeArr[ind]._x - (grid_mc.step * ((grid_mc.XSteps / 2) - 0.5));
clear_mc.bonus._y = placeArr[ind]._y;
fields_mc.points_txt.text = Number(fields_mc.points_txt.text) + 50;
}
counter = 0;
isBonus = true;
}
if (ind == placeArr.length) {
delete this.onEnterFrame;
gems.removeMovieClip();
newString.removeMovieClip();
gems_mc.level++;
gems_mc.setLevel();
gems_mc.startGenerate();
gems_mc.generateString();
fields_mc.level_txt.text = gems_mc.level + 1;
fields_mc.lines_txt.text = 25 + (gems_mc.level * 2);
up_btn.enabled = true;
gems_mc.enableGems(true);
win_mc._visible = true;
if (gems_mc.level < 15) {
win_mc.level_txt.text = gems_mc.level + 1;
createEmptyMovieClip("btnPause_mc", 200000);
btnPause_mc.attachMovie("tmp", "btn", 0);
btnPause_mc.useHandCursor = false;
btnPause_mc.onPress = function () {
this.removeMovieClip();
win_mc._visible = false;
gems_mc.generateStringStart();
};
} else {
win_mc.swapDepths(200200);
win_mc._visible = true;
win_mc.gotoAndPlay("theEnd");
fields_mc.level_txt.text = gems_mc.level;
fields_mc.lines_txt.text = 0;
newString.removeMovieClip();
gems.removeMovieClip();
createEmptyMovieClip("btnPause_mc", 200000);
btnPause_mc.attachMovie("tmp", "btn", 0);
btnPause_mc.useHandCursor = false;
btnPause_mc.onPress = function () {
this.removeMovieClip();
gems.removeMovieClip();
grid.removeMovieClip();
win_mc._visible = false;
gotoAndStop (3);
};
}
}
};
};
Object.registerClass("grid", GridClass);
#endinitclip
stop();
Symbol 113 MovieClip [1] Frame 5
stop();
Symbol 113 MovieClip [1] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 116 MovieClip [2] Frame 5
stop();
Symbol 116 MovieClip [2] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 119 MovieClip [3] Frame 5
stop();
Symbol 119 MovieClip [3] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 122 MovieClip [4] Frame 5
stop();
Symbol 122 MovieClip [4] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 125 MovieClip [5] Frame 5
stop();
Symbol 125 MovieClip [5] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 126 MovieClip [6] Frame 5
stop();
Symbol 126 MovieClip [6] Frame 9
stop();
this.swapDepths(474747);
this.removeMovieClip();
Symbol 127 MovieClip [gem] Frame 1
#initclip 2
GemClass = function () {
fields_mc.level_txt.text = gems_mc.level + 1;
fields_mc.lines_txt.text = 25 + (gems_mc.level * 2);
this.setLevel();
this.startGenerate();
this.generateString();
};
GemClass.prototype.level = 0;
GemClass.prototype.numGemType = 4;
GemClass.prototype.startNumString = 5;
GemClass.prototype.maxSameGems = 4;
GemClass.prototype.gemsInStartMatrix = 3;
GemClass.prototype.numGemsToUnbreak = -1;
GemClass.prototype.numGemsToBomb = -1;
GemClass.prototype.numGemsToColorBomb = -1;
GemClass.prototype.newStringNum = 0;
GemClass.prototype.genArr = new Array();
GemClass.prototype.newID = 1;
GemClass.prototype.D = 0;
GemClass.prototype.Dup = 6;
GemClass.prototype.upInterval = 5;
GemClass.prototype.waitingString = 20;
GemClass.prototype.waitingBetweenStrings = 30;
GemClass.prototype.setLevel = function () {
if (this.level == 0) {
this.numGemType = 4;
this.startNumString = 4;
this.maxSameGems = 4;
this.gemsInStartMatrix = 3;
this.numGemsToUnbreak = -1;
this.numGemsToBomb = -1;
this.numGemsToColorBomb = -1;
} else if (this.level == 1) {
this.numGemType = 5;
this.startNumString = 5;
this.maxSameGems = 4;
this.gemsInStartMatrix = 3;
} else if (this.level == 2) {
this.numGemType = 5;
this.startNumString = 6;
this.maxSameGems = 4;
this.gemsInStartMatrix = 3;
} else if (this.level == 3) {
this.startNumString = 6;
this.maxSameGems = 3;
this.gemsInStartMatrix = 3;
this.numGemsToUnbreak = 18;
this.numGemsToBomb = 54;
this.numGemsToColorBomb = -1;
} else if (this.level == 4) {
this.startNumString = 7;
this.maxSameGems = 3;
this.gemsInStartMatrix = 2;
this.numGemsToUnbreak = -1;
this.numGemsToBomb = -1;
this.numGemsToColorBomb = 70;
} else if (this.level == 5) {
this.startNumString = 7;
this.maxSameGems = 2;
this.gemsInStartMatrix = 2;
this.numGemsToUnbreak = -1;
this.numGemsToBomb = 85;
this.numGemsToColorBomb = 120;
} else if ((this.level >= 6) && (this.level <= 10)) {
this.startNumString = 7;
this.maxSameGems = 2;
this.gemsInStartMatrix = 3;
this.numGemsToUnbreak = 90;
this.numGemsToBomb = 100;
this.numGemsToColorBomb = 220;
} else if ((this.level >= 11) && (this.level <= 15)) {
this.startNumString = 10;
this.maxSameGems = 3;
this.gemsInStartMatrix = 3;
this.numGemsToUnbreak = 70;
this.numGemsToBomb = 170;
this.numGemsToColorBomb = 350;
} else if ((this.level >= 16) && (this.level <= 20)) {
this.startNumString = 5;
this.maxSameGems = 2;
this.gemsInStartMatrix = 2;
this.numGemsToUnbreak = -1;
this.numGemsToBomb = 75;
this.numGemsToColorBomb = 210;
} else if ((this.level >= 21) && (this.level <= 25)) {
this.startNumString = 3;
this.maxSameGems = 2;
this.gemsInStartMatrix = 2;
this.numGemsToUnbreak = -1;
this.numGemsToBomb = 75;
this.numGemsToColorBomb = 170;
} else {
this.startNumString = 6;
this.maxSameGems = 3;
this.gemsInStartMatrix = 1;
this.numGemsToUnbreak = 190;
this.numGemsToBomb = 75;
this.numGemsToColorBomb = 170;
}
};
GemClass.prototype.startGenerate = function () {
var rand = null;
var isSame = false;
var prevType = null;
var gemType = "";
var countGems = this.gemsInStartMatrix;
var oldGemType = "";
createEmptyMovieClip("gems", 90000);
var i = 1;
while (i <= this.startNumString) {
isSame = false;
oldGemType = "";
var j = 1;
while (j <= grid_mc.XSteps) {
if (!isSame) {
rand = Math.random() * 10;
} else {
rand = null;
}
if (((rand != null) && (rand <= this.maxSameGems)) && (!isSame)) {
isSame = true;
gemType = "";
}
if (!isSame) {
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (gemType == oldGemType);
} else if (isSame && (gemType == "")) {
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (gemType == oldGemType);
countGems = this.gemsInStartMatrix;
countGems--;
} else if (isSame && (countGems > 0)) {
countGems--;
} else if (isSame && (countGems == 0)) {
isSame = false;
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (oldGemType == gemType);
}
oldGemType = gemType;
gems.attachMovie(gemType, "gem" + this.newID, this.newID);
eval ("gems.gem" + this.newID)._x = eval ((("grid.place_X" + j) + "Y") + i)._x + this.D;
eval ("gems.gem" + this.newID)._y = eval ((("grid.place_X" + j) + "Y") + i)._y + this.D;
eval ("gems.gem" + this.newID)._xscale = (eval ("gems.gem" + this.newID)._yscale = 100);
eval ((("grid.place_X" + j) + "Y") + i).gem = "gems.gem" + this.newID;
eval ((("grid.place_X" + j) + "Y") + i).gemType = Number(gemType);
this.newID++;
j++;
}
i++;
}
};
GemClass.prototype.generateString = function () {
var rand = null;
var isSame = false;
var prevType = null;
var gemType = "";
var countGems = this.gemsInStartMatrix;
var oldGemType = "";
var numOfBombsInStr = 0;
var numOfColorBombsInStr = 0;
this.genArr = new Array();
if (newString == undefined) {
createEmptyMovieClip("newString", 90001);
}
var j = 1;
while (j <= grid_mc.XSteps) {
rand = Math.random() * 10;
if ((Math.random() <= (this.numGemsToUnbreak / (((this.level * 2) + 25) * grid_mc.XSteps))) && (oldGemType != "6")) {
gemType = "6";
} else if ((Math.random() <= (this.numGemsToBomb / (((this.level * 2) + 25) * grid_mc.XSteps))) && ((((((oldGemType != "b1") || (oldGemType != "b2")) || (oldGemType != "b3")) || (oldGemType != "b4")) || (oldGemType != "b5")) || (oldGemType != "b0"))) {
if (numOfBombsInStr < 2) {
gemType = "b0";
numOfBombsInStr++;
} else if ((rand <= this.maxSameGems) && (!isSame)) {
isSame = true;
gemType = "";
}
} else if ((Math.random() <= (this.numGemsToColorBomb / (((this.level * 2) + 25) * grid_mc.XSteps))) && ((((((oldGemType != "b1") || (oldGemType != "b2")) || (oldGemType != "b3")) || (oldGemType != "b4")) || (oldGemType != "b5")) || (oldGemType != "b0"))) {
if (numOfColorBombsInStr < 1) {
gemType = "b" + Math.round((4 * Math.random()) + 1);
numOfColorBombsInStr++;
} else if ((rand <= this.maxSameGems) && (!isSame)) {
isSame = true;
gemType = "";
}
} else if ((rand <= this.maxSameGems) && (!isSame)) {
isSame = true;
gemType = "";
}
if (!isSame) {
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (gemType == oldGemType);
} else if (isSame && (gemType == "")) {
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (gemType == oldGemType);
countGems = this.gemsInStartMatrix;
countGems--;
} else if (isSame && (countGems > 0)) {
countGems--;
} else if (isSame && (countGems == 0)) {
isSame = false;
do {
gemType = String(Math.round(((this.numGemType - 1) * Math.random()) + 1));
} while (oldGemType == gemType);
}
oldGemType = gemType;
this.genArr.push(gemType);
newString.attachMovie(gemType, "gem" + j, j);
eval ("newString.gem" + j)._x = j * grid_mc.step;
eval ("newString.gem" + j)._y = 0;
eval ("gems.gem" + this.newID)._xscale = (eval ("gems.gem" + this.newID)._yscale = 100);
if (((((((gemType == "6") || (gemType == "b0")) || (gemType == "b1")) || (gemType == "b2")) || (gemType == "b3")) || (gemType == "b4")) || (gemType == "b5")) {
gemType = "";
}
j++;
}
newString._x = 180 - newString._width;
newString._y = 359;
newString.setMask(mask_mc);
this.newStringNum++;
};
GemClass.prototype.generateStringStart = function () {
var D = 5;
var X = 199;
var counter = this.waitingString;
var superClass = this;
newString.onEnterFrame = function () {
if ((X - newString._x) > D) {
newString._x = newString._x + D;
} else {
newString._x = X;
delete this.onEnterFrame;
newString.onEnterFrame = function () {
counter--;
if (counter == 0) {
delete this.onEnterFrame;
superClass.enableGems(false);
grid.onEnterFrame = function () {
var _local2 = grid_mc.checkOnEnterFrame();
if (!_local2) {
_local2 = true;
superClass.enableGems(false);
superClass.up(superClass.genArr);
delete this.onEnterFrame;
newString.removeMovieClip();
}
};
}
};
}
};
};
GemClass.prototype.up = function (arr) {
delete newString.onEnterFrame;
if (Number(fields_mc.lines_txt.text) > 0) {
fields_mc.lines_txt.text = Number(fields_mc.lines_txt.text) - 1;
} else {
return(undefined);
}
var D = this.Dup;
var placeName = "";
var newPlaceName = "";
var superClass = this;
var counter = superClass.waitingBetweenStrings;
up_btn.enabled = false;
newString.removeMovieClip();
var i = grid_mc.YSteps;
while (i >= 1) {
var j = 1;
while (j <= grid_mc.XSteps) {
placeName = (("grid.place_X" + j) + "Y") + i;
if ((i == grid_mc.YSteps) && (eval (placeName).gem != "none")) {
win_mc.swapDepths(200200);
win_mc._visible = true;
win_mc.gotoAndPlay("gameOver");
createEmptyMovieClip("btnPause_mc", 200220);
btnPause_mc.attachMovie("tmp", "btn", 0);
btnPause_mc.useHandCursor = false;
btnPause_mc.onPress = function () {
this.removeMovieClip();
gems.removeMovieClip();
grid.removeMovieClip();
win_mc._visible = false;
gotoAndStop (3);
};
return(undefined);
}
if (eval (placeName).gem != "none") {
eval (eval (placeName).gem)._y = eval (eval (placeName).gem)._y - grid_mc.step;
newPlaceName = (("grid.place_X" + j) + "Y") + (eval (placeName).Y + 1);
eval (newPlaceName).gem = eval (placeName).gem;
eval (newPlaceName).gemType = eval (placeName).gemType;
eval (placeName).gem = "none";
eval (placeName).gemType = 0;
}
j++;
}
i--;
}
gems._y = gems._y + grid_mc.step;
var i = 0;
while (i < arr.length) {
placeName = ("grid.place_X" + (i + 1)) + "Y1";
gems.attachMovie(arr[i], "gem" + this.newID, this.newID);
eval ("gems.gem" + this.newID)._x = eval (placeName)._x;
eval ("gems.gem" + this.newID)._y = eval (placeName)._y;
eval ("gems.gem" + this.newID).gotoAndStop(5);
eval (placeName).gem = "gems.gem" + this.newID;
eval (placeName).gemType = arr[i];
this.newID++;
i++;
}
var stopPoint = (gems._y - grid_mc.step);
add_sound.start(0, 1);
gems.onEnterFrame = function () {
if ((gems._y - stopPoint) >= D) {
gems._y = gems._y - D;
} else {
gems._y = stopPoint;
superClass.enableGems(true);
delete this.onEnterFrame;
up_btn.enabled = true;
if (Number(fields_mc.lines_txt.text) <= 0) {
grid_mc.clearField();
return(undefined);
}
superClass.generateString();
gems.onEnterFrame = function () {
counter--;
if (counter == 0) {
delete this.onEnterFrame;
superClass.generateStringStart();
}
};
}
};
};
GemClass.prototype.enableGems = function (isEnable) {
var place = null;
var x = 1;
while (x <= grid_mc.XSteps) {
var y = grid_mc.YSteps;
while (y >= 1) {
place = eval ((("grid.place_X" + x) + "Y") + y);
if (place.gem == "none") {
} else {
place.enabled = isEnable;
}
y--;
}
x++;
}
};
Object.registerClass("gem", GemClass);
#endinitclip
stop();
Symbol 147 MovieClip Frame 24
gotoAndPlay (1);
Symbol 147 MovieClip Frame 48
gotoAndPlay (25);
Instance of Symbol 145 MovieClip in Symbol 147 MovieClip Frame 49
on (press) {
getURL ("http://www.justfreegames.com", "_blank");
}
Symbol 147 MovieClip Frame 72
gotoAndPlay (49);