Frame 1
total = getBytesTotal();
Frame 4
loaded = getBytesLoaded();
percent = 100 * (loaded / total);
this.loaderhold.loader._yscale = percent;
Frame 5
if (percent < 99) {
gotoAndPlay (4);
}
Frame 33
attachMovie("intro", "intro", 100);
intro._x = 216;
intro._y = 216;
action = "intro";
function definesounds() {
clicksound = new Sound();
clicksound.attachSound("click");
}
function displaygrid() {
i = 0;
while (i < 64) {
a = griddata[i];
b = Math.floor(i / 8);
c = ((i - (b * 8)) * 40) + 55;
if (a == 0) {
removeMovieClip(eval ("b" + i));
}
if (a > 0) {
attachMovie("block", "b" + i, i + 200);
with (eval ("b" + i)) {
_x = c;
_y = (b * 40) + 55;
gotoAndStop(2);
clip.gotoAndStop(a);
}
attachMovie("select", "s" + i, i + 100);
with (eval ("s" + i)) {
hold.n = i;
_x = c;
_y = (b * 40) + 55;
gotoAndStop(1);
}
}
i++;
}
action = "nothing";
}
function fillinempties() {
emp = 0;
i = 0;
while (i < 64) {
a = griddata[i];
if (a == 0) {
emp++;
griddata[i] = random(6) + 2;
a = griddata[i];
b = Math.floor(i / 8);
c = i - (b * 8);
attachMovie("block", "b" + i, i + 200);
with (eval ("b" + i)) {
_x = (c * 40) + 55;
_y = (b * 40) + 55;
gotoAndStop(2);
clip.gotoAndStop(a);
_alpha = 10;
}
attachMovie("select", "s" + i, i + 100);
with (eval ("s" + i)) {
hold.n = i;
_x = (c * 40) + 55;
_y = (b * 40) + 55;
gotoAndStop(1);
}
}
i++;
}
}
function generateemptygrid() {
found = 1;
count = 0;
putinjokers = 0;
while (found > 0) {
count++;
griddata = new Array();
i = 0;
while (i < 64) {
putinjokers++;
if (putinjokers < 13) {
griddata.push(random(6) + 2);
} else {
griddata.push(random(5) + 10);
putinjokers = 0;
}
i++;
}
testrows();
}
}
function moveit() {
i = 0;
while (i < amounttomove) {
b = movearray[i];
c = movearray[i + 1];
eval ("b" + b).control.drop = c;
eval ("b" + b).control.state = 1;
i = i + 2;
}
}
function resetselection() {
i = 0;
while (i < 64) {
eval ("s" + i).gotoAndStop(1);
i++;
}
}
function resetgrid() {
i = 0;
while (i < 64) {
a = griddata[i];
b = Math.floor(i / 8);
c = ((i - (b * 8)) * 40) + 55;
if (a > 0) {
with (eval ("b" + i)) {
_x = c;
_y = (b * 40) + 55;
gotoAndStop(2);
clip.gotoAndStop(a);
control.drop = 0;
control.state = 0;
}
with (eval ("s" + i)) {
hold.n = i;
_x = c;
_y = (b * 40) + 55;
gotoAndStop(1);
}
}
if (a == 0) {
removeMovieClip(eval ("b" + i));
}
i++;
}
action = "nothing";
}
function specialeffect(effectnumber) {
b = pressed;
if (effectnumber == 1) {
griddata[b - 8] = 0;
eval ("b" + (b - 8)).play();
griddata[b + 8] = 0;
eval ("b" + (b + 8)).play();
effects = new Array(0, -1, 1);
i = 0;
while (i < effects.length) {
val = effects[i];
test1 = Math.floor(b / 8);
test2 = Math.floor((b + val) / 8);
if (test1 == test2) {
griddata[b + val] = 0;
eval ("b" + (b + val)).play();
}
i++;
}
}
if (effectnumber == 2) {
b = pressed;
test1 = Math.floor(b / 8);
i = b - 8;
while (i < (b + 8)) {
test2 = Math.floor(i / 8);
if (test1 == test2) {
griddata[i] = 0;
eval ("b" + i).play();
}
i++;
}
}
if (effectnumber == 3) {
b = pressed;
i = b - 64;
while (i < (b + 64)) {
griddata[i] = 0;
eval ("b" + i).play();
i = i + 8;
}
}
if (effectnumber == 4) {
b = pressed;
i = b;
while (i < 64) {
griddata[i] = 0;
eval ("b" + i).play();
i = i + 9;
}
i = b;
while (i > 0) {
griddata[i] = 0;
eval ("b" + i).play();
i = i - 9;
}
i = b;
while (i > 0) {
griddata[i] = 0;
eval ("b" + i).play();
i = i - 7;
}
i = b;
while (i < 64) {
griddata[i] = 0;
eval ("b" + i).play();
i = i + 7;
}
}
action = "squash fruit";
}
function testformatch(swapa, swapb) {
var _local1 = swapa;
var _local2 = swapb;
tempgrid2 = griddata;
tempgrid = griddata;
aaa = tempgrid[_local1];
tempgrid[_local1] = tempgrid[_local2];
tempgrid[_local2] = aaa;
matchfound = 0;
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = i + (j * 8);
a = tempgrid[tl];
if (a > 0) {
b = tempgrid[tl + 1];
c = tempgrid[tl + 2];
if ((a == b) && (a == c)) {
d = tempgrid[tl + 3];
e = tempgrid[tl + 4];
if (i < 4) {
if ((a == d) && (a == e)) {
matchfound = 1;
break;
}
}
if (i < 5) {
if (a == d) {
matchfound = 1;
break;
}
}
if (i < 6) {
matchfound = 1;
break;
}
}
}
i++;
}
j++;
}
if (matchfound == 0) {
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = j + (i * 8);
a = tempgrid[tl];
if (a > 0) {
b = tempgrid[tl + 8];
c = tempgrid[tl + 16];
if ((a == b) && (a == c)) {
d = tempgrid[tl + 24];
e = tempgrid[tl + 32];
if (i < 4) {
if ((a == d) && (a == e)) {
matchfound = 1;
break;
}
}
if (i < 5) {
if (a == d) {
matchfound = 1;
break;
}
}
if (i < 6) {
matchfound = 1;
break;
}
}
}
i++;
}
j++;
}
if (matchfound == 0) {
tempgrid[_local2] = tempgrid[_local1];
tempgrid[_local1] = aaa;
}
}
}
function testrows() {
matchex = 0;
locx = 0;
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = i + (j * 8);
a = griddata[tl];
if (a > 0) {
b = griddata[tl + 1];
c = griddata[tl + 2];
if ((a == b) && (a == c)) {
d = griddata[tl + 3];
e = griddata[tl + 4];
if (i < 4) {
if ((a == d) && (a == e)) {
locx = tl;
matchex = 5;
break;
}
}
if (i < 5) {
if (a == d) {
locx = tl;
matchex = 4;
break;
}
}
if (i < 6) {
locx = tl;
matchex = 3;
break;
}
}
}
i++;
}
j++;
}
matchey = 0;
locy = 0;
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = j + (i * 8);
a = griddata[tl];
b = griddata[tl + 8];
c = griddata[tl + 16];
if ((a == b) && (a == c)) {
d = griddata[tl + 24];
e = griddata[tl + 32];
if (i < 4) {
if ((a == d) && (a == e)) {
locy = tl;
matchey = 5;
break;
}
}
if (i < 5) {
if (a == d) {
locy = tl;
matchey = 4;
break;
}
}
if (i < 6) {
locy = tl;
matchey = 3;
break;
}
}
i++;
}
j++;
}
found = 0;
if ((matchex > 0) || (matchey > 0)) {
found = 1;
}
}
function testformatches() {
popem = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
matchex = 0;
locx = 0;
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = i + (j * 8);
a = griddata[tl];
if (a > 0) {
b = griddata[tl + 1];
c = griddata[tl + 2];
if ((a == b) && (a == c)) {
d = griddata[tl + 3];
e = griddata[tl + 4];
if (i < 4) {
if ((a == d) && (a == e)) {
locx = tl;
matchex = 5;
popem[locx] = 1;
popem[locx + 1] = 1;
popem[locx + 2] = 1;
popem[locx + 3] = 1;
popem[locx + 4] = 1;
score = score + 150;
popped = popped + 5;
break;
}
}
if (i < 5) {
if (a == d) {
locx = tl;
matchex = 4;
popem[locx] = 1;
popem[locx + 1] = 1;
popem[locx + 2] = 1;
popem[locx + 3] = 1;
score = score + 100;
popped = popped + 4;
break;
}
}
if (i < 6) {
locx = tl;
matchex = 3;
popem[locx] = 1;
popem[locx + 1] = 1;
popem[locx + 2] = 1;
score = score + 75;
popped = popped + 3;
break;
}
}
}
i++;
}
j++;
}
matchey = 0;
locy = 0;
j = 0;
while (j < 8) {
i = 0;
while (i < 6) {
tl = j + (i * 8);
a = griddata[tl];
if (a > 0) {
b = griddata[tl + 8];
c = griddata[tl + 16];
if ((a == b) && (a == c)) {
d = griddata[tl + 24];
e = griddata[tl + 32];
if (((i < 4) && (a == d)) && (a == e)) {
locy = tl;
matchey = 5;
popem[locy] = 1;
popem[locy + 8] = 1;
popem[locy + 16] = 1;
popem[locy + 24] = 1;
popem[locy + 32] = 1;
score = score + 150;
popped = popped + 5;
break;
}
if ((i < 5) && (a == d)) {
locy = tl;
matchey = 4;
popem[locy] = 1;
popem[locy + 8] = 1;
popem[locy + 16] = 1;
popem[locy + 24] = 1;
score = score + 100;
popped = popped + 4;
break;
}
if (i < 6) {
locy = tl;
matchey = 3;
popem[locy] = 1;
popem[locy + 8] = 1;
popem[locy + 16] = 1;
score = score + 75;
popped = popped + 3;
break;
}
}
}
i++;
}
j++;
}
found = 0;
if ((matchex > 0) || (matchey > 0)) {
found = 1;
i = 0;
while (i < 64) {
if (popem[i] == 1) {
griddata[i] = 0;
eval ("b" + i).play();
}
i++;
}
}
}
function updatedisplay() {
i = 0;
while (i < 64) {
a = griddata[i];
b = Math.floor(i / 8);
c = ((i - (b * 8)) * 40) + 55;
with (eval ("b" + i)) {
_x = c;
_y = (b * 40) + 55;
gotoAndStop(2);
clip.gotoAndStop(a);
}
with (eval ("s" + i)) {
hold.n = i;
_x = c;
_y = (b * 40) + 55;
gotoAndStop(1);
}
i++;
}
}
function updatearray() {
i = 0;
while (i < movearraytemp.length) {
b = movearraytemp[i];
c = movearraytemp[i + 1];
d = griddata[b];
e = b + (c * 8);
griddata[e] = d;
griddata[b] = 0;
i = i + 2;
}
}
function selectfirstblock() {
a = griddata[pressed];
if (a < 11) {
clicksound.start();
sel1 = pressed;
pressed = -1;
sel2 = -1;
eval ("s" + sel1).gotoAndPlay(2);
} else if (a > 10) {
sel1 = 0;
b = pressed;
if (a == 11) {
specialeffect(1);
}
if (a == 12) {
specialeffect(2);
}
if (a == 13) {
specialeffect(3);
}
if (a == 14) {
specialeffect(4);
}
pressed = -1;
}
}
function selectsecondblock() {
clicksound.start();
sel2 = pressed;
pressed = -1;
proceed = 0;
movepeice = sel2 - sel1;
if (movepeice == 0) {
eval ("s" + sel1).gotoAndStop(1);
sel1 = -1;
sel2 = -1;
} else if ((((movepeice == 8) || (movepeice == -8)) || (movepeice == 1)) || (movepeice == -1)) {
testformatch(sel1, sel2);
if (matchfound == 0) {
eval ("s" + sel1).gotoAndStop(1);
sel1 = -1;
sel2 = -1;
action = "start display bad move";
} else if (matchfound == 1) {
switch1 = sel1;
switch2 = sel2;
sel1 = -1;
sel2 = -1;
action = "swap fruit";
a = "b" + switch1;
b = "b" + switch2;
sx1 = eval (a)._x;
sy1 = eval (a)._y;
sx2 = eval (b)._x;
sy2 = eval (b)._y;
switch1movex = (sx2 - sx1) / 4;
switch1movey = (sy2 - sy1) / 4;
switch2movex = (sx1 - sx2) / 4;
switch2movey = (sy1 - sy2) / 4;
}
} else {
sel1 = -1;
sel2 = -1;
displaygrid();
}
}
function animatebadmove() {
anicount++;
if (anicount > 8) {
pressed = -1;
sel1 = -1;
sel2 = -1;
action = "nothing";
}
}
function startup() {
spaceship.ship.gotoAndStop(1);
pressed = -1;
sel1 = -1;
sel2 = -1;
track = 0;
maxtime = 0;
movingblocks = 0;
dropactive = 0;
popped = 0;
targetpop = 60;
score = 0;
shipanim = 1;
totaltime = 90;
time = totaltime;
playedship = 0;
generateemptygrid();
oldtime = getTimer();
action = "display grid";
definesounds();
}
function scanformovements() {
movearray = new Array();
j = 0;
while (j < 8) {
blankcount = 0;
i = 7;
while (i > -1) {
num = (i * 8) + j;
if (griddata[num] == 0) {
blankcount++;
} else if (blankcount > 0) {
movearray.push(num, blankcount);
}
i--;
}
j++;
}
movearraytemp = movearray;
}
function squashingfruit() {
if (anicount < 8) {
anicount++;
} else {
action = "scan for empties";
sel = -1;
sel2 = -1;
}
percent = Math.floor((popped / targetpop) * 100);
if (percent >= 100) {
percent = 100;
shipanim = 6;
playedship = 1;
spaceship.ship.gotoAndPlay(6);
i = 0;
while (i < 64) {
eval ("b" + i).play();
removeMovieClip(eval ("s" + i));
i++;
}
attachMovie("complete", "go", 100);
go._x = 216;
go._y = 216;
anicount = 0;
action = "level complete animation";
} else {
if (percent < 30) {
shipanim = 1;
} else if (percent > 80) {
shipanim = 4;
} else if (percent > 56) {
shipanim = 3;
} else if (percent > 29) {
shipanim = 2;
}
spaceship.ship.gotoAndStop(shipanim);
}
}
function finishlevel() {
}
function frameaction() {
if (((action != "intro") && (action != "start")) && (action != "gameover")) {
a = 300 - Math.floor((popped / targetpop) * 300);
b = meter.level._y;
if (Math.abs(a - b) > 1) {
if (b < a) {
meter.level._y = meter.level._y + 1;
} else if (b > a) {
meter.level._y = meter.level._y - 1;
}
if (meter.level._y < 0) {
meter.level._y = 0;
}
}
now = getTimer();
dif = now - oldtime;
if (dif > 1000) {
oldtime = now;
time--;
if (time < 1) {
i = 0;
while (i < 64) {
eval ("b" + i).play();
removeMovieClip(eval ("s" + i));
i++;
}
attachMovie("gameover", "go", 100);
go._x = 216;
go._y = 216;
action = "gameover";
}
}
if (dropactive > 0) {
dropdelay++;
}
if (movingblocks > 0) {
action = "wait for dropping to finish";
}
if (((movingblocks == 0) && (dropactive == 1)) && (dropdelay > dropdelaywait)) {
updatearray();
resetgrid();
dropactive = 0;
dropdelay = 0;
action = "find all combos";
}
}
switch (action) {
case "start drop fruit" :
dropdelay = 0;
moveit();
dropactive = 1;
dropdelaywait = 1 + (amounttomove / 2);
action = "wait for dropping to finish";
return;
case "swap fruit" :
action = "animate swap fruit";
anicount = 0;
return;
case "animate swap fruit" :
if (anicount < 8) {
a = "b" + switch1;
b = "b" + switch2;
eval (a)._x = eval (a)._x + switch1movex;
eval (a)._y = eval (a)._y + switch1movey;
eval (b)._x = eval (b)._x + switch2movex;
eval (b)._y = eval (b)._y + switch2movey;
switch1movex = switch1movex * 0.75;
switch1movey = switch1movey * 0.75;
switch2movex = switch2movex * 0.75;
switch2movey = switch2movey * 0.75;
anicount++;
} else {
anicount = 0;
action = "find all combos";
b = griddata[sel1];
c = griddata[sel2];
griddata[sel1] = c;
griddata[sel2] = b;
updatedisplay();
}
return;
case "find all combos" :
testformatches();
action = "squash fruit";
return;
case "squash fruit" :
anicount = 0;
action = "squashing fruit";
return;
case "squashing fruit" :
squashingfruit();
return;
case "level complete animation" :
action = "gameover";
return;
case "start display bad move" :
anicount = 0;
action = "display bad move";
return;
case "display bad move" :
animatebadmove();
return;
case "nothing" :
if (popped > 0) {
if (popper > targetpop) {
percent = 0;
} else {
percent = 300 - ((popped / targetpop) * 300);
}
} else {
percent = 300;
}
if (pressed > -1) {
if (sel1 == -1) {
selectfirstblock();
} else {
selectsecondblock();
}
}
return;
case "wait for dropping to finish" :
return;
case "scan for empties" :
scanformovements();
amounttomove = movearray.length;
if (amounttomove > 0) {
action = "start drop fruit";
} else {
fillinempties();
if (emp > 0) {
anicount = 0;
action = "waiting for empties to fill";
} else {
action = "nothing";
}
}
return;
case "waiting for empties to fill" :
anicount++;
if (anicount > 16) {
testformatches();
if (found == 0) {
action = "scan for empties";
}
}
return;
case "start" :
startup();
return;
case "display grid" :
displaygrid();
action = "nothing";
}
}
Frame 43
stop();
Instance of Symbol 111 MovieClip in Frame 43
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 44
stop();
Frame 54
stop();
Symbol 5 MovieClip Frame 24
stop();
Symbol 31 MovieClip Frame 1
stop();
Symbol 31 MovieClip Frame 105
_root.finishlevel();
stop();
Symbol 37 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 1
stop();
Instance of Symbol 39 MovieClip "control" in Symbol 61 MovieClip Frame 1
onClipEvent (load) {
drop = 0;
state = 0;
count = 0;
}
onClipEvent (enterFrame) {
if (state > 0) {
if (state == 1) {
count = 4 * drop;
state = 2;
} else if ((state == 2) && (count > 0)) {
count--;
_parent._y = _parent._y + 10;
_root.movingblocks = 1;
}
if ((count < 1) && (state == 2)) {
state = 0;
drop = 0;
_root.movingblocks = 0;
}
}
}
Symbol 62 MovieClip [block] Frame 1
stop();
Instance of Symbol 39 MovieClip "control" in Symbol 62 MovieClip [block] Frame 2
onClipEvent (load) {
drop = 0;
state = 0;
count = 0;
}
onClipEvent (enterFrame) {
if (state > 0) {
if (state == 1) {
count = 4 * drop;
state = 2;
} else if ((state == 2) && (count > 0)) {
count--;
_parent._y = _parent._y + 10;
_root.movingblocks = 1;
}
if ((count < 1) && (state == 2)) {
state = 0;
drop = 0;
_root.movingblocks = 0;
}
} else if (_parent._alpha < 100) {
_parent._alpha = _parent._alpha + 5;
}
}
Symbol 64 Button
on (press) {
_root.pressed = hold.n;
}
Symbol 68 MovieClip [select] Frame 1
stop();
Symbol 68 MovieClip [select] Frame 3
stop();
Symbol 77 MovieClip Frame 1
stop();
Symbol 84 Button
on (press) {
_root.action = "start";
}
Symbol 117 MovieClip Frame 11
stop();
Symbol 118 Button
on (release) {
gotoAndPlay (55);
}