Frame 1
playing = 0;
pause = 1;
snd1 = new Sound(_root.snd1);
snd1.attachSound("snd1");
snd2 = new Sound(_root.snd2);
snd2.attachSound("snd2");
snd3 = new Sound(_root.snd3);
snd3.attachSound("snd3");
stop();
Instance of Symbol 31 MovieClip in Frame 1
onClipEvent (enterFrame) {
text = ((int(_parent.getBytesLoaded() / 1000) add " OF ") add int(_parent.getBytesTotal() / 1000)) add " LOADED ...";
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
_root.goButton._x = 165;
}
}
Frame 2
function setStage() {
var _local3 = this;
var _local2 = 0;
while (_local2 < height) {
var _local1 = 0;
while (_local1 < width) {
_local3.attachMovie("tile", (("t_" + _local2) + "_") + _local1, ++d);
t = _local3[(("t_" + _local2) + "_") + _local1];
t._x = _local1 * size;
t._y = (_local2 * size) - space;
t.gotoAndStop(8);
t.state = 0;
_local1++;
}
_local2++;
}
}
function createBriks() {
var _local3 = this;
var _local1 = 0;
while (_local1 < 3) {
if (firstTime) {
var _local2 = random(colors) + 1;
} else {
var _local2 = arr[_local1];
}
_local3[(("t_" + (py - _local1)) + "_") + px].gotoAndStop(_local2);
map[py - _local1][px] = _local2;
_local1++;
}
nextBrik();
}
function nextBrik() {
var _local3 = this;
var _local1 = 0;
while (_local1 < 3) {
var _local2 = random(colors) + 1;
_local3["t" + _local1].gotoAndStop(_local2);
arr[_local1] = _local2;
_local1++;
}
}
function levelUp() {
level++;
if (level == 4) {
colors = 6;
}
if (level == 10) {
colors = 7;
}
clearInterval(gameClock);
speed = Math.round(0.96 * speed);
}
function moveDown() {
if ((map[py + 1][px] != 8) and (py <= 3)) {
clearInterval(gameClock);
hitsomething = 1;
nextFrame();
return(undefined);
}
if ((map[py + 1][px] == 8) and (py != 16)) {
map[py + 1][px] = map[py][px];
map[py][px] = map[py - 1][px];
map[py - 1][px] = map[py - 2][px];
map[py - 2][px] = 8;
updateScreen();
py++;
} else {
brikSound = 1;
hitsomething = 1;
clearInterval(gameClock);
doCheck();
}
}
function moveLeft() {
var _local3 = this;
if ((px - 1) < 0) {
} else if (py < 3) {
} else {
var left = 0;
if (((map[py][px - 1] == 8) and (map[py - 1][px - 1] == 8)) and (map[py - 2][px - 1] == 8)) {
left = 1;
}
if ((!hitsomething) and left) {
map[py][px - 1] = map[py][px];
map[py - 1][px - 1] = map[py - 1][px];
map[py - 2][px - 1] = map[py - 2][px];
var _local1 = 0;
while (_local1 < 3) {
_local3[(("t_" + (py - _local1)) + "_") + (px - 1)].gotoAndStop(map[py - _local1][px - 1]);
_local1++;
}
_local1 = 0;
while (_local1 < 3) {
var _local2 = 8;
map[py - _local1][px] = _local2;
_local3[(("t_" + (py - _local1)) + "_") + px].gotoAndStop(_local2);
_local1++;
}
px--;
}
}
}
function moveRight() {
var _local3 = this;
if ((px + 1) > (width - 1)) {
} else if (py < 3) {
} else {
var right = 0;
if (((map[py][px + 1] == 8) and (map[py - 1][px + 1] == 8)) and (map[py - 2][px + 1] == 8)) {
right = 1;
}
if ((!hitsomething) and right) {
map[py][px + 1] = map[py][px];
map[py - 1][px + 1] = map[py - 1][px];
map[py - 2][px + 1] = map[py - 2][px];
var _local1 = 0;
while (_local1 < 3) {
_local3[(("t_" + (py - _local1)) + "_") + (px + 1)].gotoAndStop(map[py - _local1][px + 1]);
_local1++;
}
_local1 = 0;
while (_local1 < 3) {
var _local2 = 8;
map[py - _local1][px] = _local2;
_local3[(("t_" + (py - _local1)) + "_") + px].gotoAndStop(_local2);
_local1++;
}
px++;
}
}
}
function updateScreen() {
var _local1 = this;
_local1[(("t_" + (py - 2)) + "_") + px].gotoAndStop(map[py - 2][px]);
_local1[(("t_" + (py - 1)) + "_") + px].gotoAndStop(map[py - 1][px]);
_local1[(("t_" + py) + "_") + px].gotoAndStop(map[py][px]);
_local1[(("t_" + (py + 1)) + "_") + px].gotoAndStop(map[py + 1][px]);
}
function rotateBriks() {
if ((!hitsomething) and (!klik)) {
klik = 1;
snd2.start(0, 1);
var _local1 = map[py][px];
map[py][px] = map[py - 1][px];
map[py - 1][px] = map[py - 2][px];
map[py - 2][px] = _local1;
updateScreen();
}
}
function findTile(y, x) {
var _local1 = y;
var _local2 = x;
var _local3 = this;
var c = map[_local1][_local2];
if (c != 8) {
if ((map[_local1 - 1][_local2] == c) and (map[_local1 - 2][_local2] == c)) {
_local3[(("t_" + _local1) + "_") + _local2].state = 1;
_local3[(("t_" + (_local1 - 1)) + "_") + _local2].state = 1;
_local3[(("t_" + (_local1 - 2)) + "_") + _local2].state = 1;
}
if ((map[_local1][_local2 + 1] == c) and (map[_local1][_local2 + 2] == c)) {
_local3[(("t_" + _local1) + "_") + _local2].state = 1;
_local3[(("t_" + _local1) + "_") + (_local2 + 1)].state = 1;
_local3[(("t_" + _local1) + "_") + (_local2 + 2)].state = 1;
}
if ((map[_local1 + 1][_local2 + 1] == c) and (map[_local1 + 2][_local2 + 2] == c)) {
_local3[(("t_" + _local1) + "_") + _local2].state = 1;
_local3[(("t_" + (_local1 + 1)) + "_") + (_local2 + 1)].state = 1;
_local3[(("t_" + (_local1 + 2)) + "_") + (_local2 + 2)].state = 1;
}
if ((map[_local1 + 1][_local2 - 1] == c) and (map[_local1 + 2][_local2 - 2] == c)) {
_local3[(("t_" + _local1) + "_") + _local2].state = 1;
_local3[(("t_" + (_local1 + 1)) + "_") + (_local2 - 1)].state = 1;
_local3[(("t_" + (_local1 + 2)) + "_") + (_local2 - 2)].state = 1;
}
}
}
function resetStates() {
var _local3 = this;
var _local2 = 0;
while (_local2 < height) {
var _local1 = 0;
while (_local1 < width) {
_local3[(("t_" + _local2) + "_") + _local1].state = 0;
_local1++;
}
_local2++;
}
}
function removeTile() {
var _local3 = this;
var _local2 = 0;
while (_local2 < height) {
var _local1 = 0;
while (_local1 < width) {
if (map[_local2][_local1] != 8) {
if (_local3[(("t_" + _local2) + "_") + _local1].state == 1) {
var frame = map[_local2][_local1];
map[_local2][_local1] = 8;
score = score + 100;
_local3[(("t_" + _local2) + "_") + _local1].gotoAndStop(8);
if (brikSound) {
snd1.start(0, 1);
brikSound = 0;
}
_local3.attachMovie("tmp", "tmp" + t, ++d);
_local3["tmp" + t]._x = _local1 * size;
_local3["tmp" + t]._y = (_local2 * size) - space;
_local3["tmp" + t].shape.gotoAndStop(frame);
t++;
}
}
_local1++;
}
_local2++;
}
}
function fallTile() {
var _local3 = this;
var f = 0;
var _local2 = 0;
while (_local2 < height) {
var _local1 = 0;
while (_local1 < width) {
if ((map[_local2][_local1] != 8) and (map[_local2 + 1][_local1] == 8)) {
f = 1;
map[_local2 + 1][_local1] = map[_local2][_local1];
_local3[(("t_" + (_local2 + 1)) + "_") + _local1].gotoAndStop(map[_local2][_local1]);
map[_local2][_local1] = 8;
_local3[(("t_" + _local2) + "_") + _local1].gotoAndStop(8);
}
_local1++;
}
_local2++;
}
if (!f) {
score = score + 10;
brikCounter++;
if (brikCounter == 10) {
brikCounter = 1;
levelUp();
}
hitsomething = 0;
py = 2;
px = 3;
createBriks();
gameClock = setInterval(_local3, "moveDown", speed);
} else {
_root.doCheck();
}
}
function doCheck() {
resetStates();
var _local2 = 0;
while (_local2 < height) {
var _local1 = 0;
while (_local1 < width) {
if (map[_local2][_local1] != 8) {
findTile(_local2, _local1);
}
_local1++;
}
_local2++;
}
removeTile();
fallTile();
}
function initialise() {
arr = [];
firstTime = 1;
brikCount = 1;
setStage();
createBriks();
nextBrik();
gameClock = setInterval(this, "moveDown", speed);
Key.addListener(_root);
hitsomething = 0;
klik = 0;
level = 1;
score = 0;
firstTime = 0;
t = 1;
}
map = [[8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8]];
_root.onKeyDown = function () {
if (!hitsomething) {
if (Key.isDown(37)) {
moveLeft();
}
if (Key.isDown(39)) {
moveRight();
}
if (Key.isDown(40)) {
moveDown();
}
if (Key.isDown(17)) {
rotateBriks();
}
updateAfterEvent();
}
};
_root.onKeyUp = function () {
klik = 0;
};
d = 0;
px = 3;
py = 2;
width = 7;
height = 16;
size = 30;
space = 90;
colors = 5;
speed = 600;
initialise();
stop();
Frame 3
var y = 0;
while (y < height) {
var x = 0;
while (x < width) {
removeMovieClip(this[(("t_" + y) + "_") + x]);
x++;
}
y++;
}
stop();
Symbol 14 MovieClip [tmp] Frame 20
removeMovieClip(this);
Symbol 28 MovieClip [tile] Frame 8
shape.gotoAndStop(random(7) + 1);
Symbol 35 Button
on (press) {
nextFrame();
}
Symbol 39 Button
on (press) {
getURL ("http://lightforce.freestuff.gr", "_blank");
}
Symbol 47 Button
on (release) {
if (playing == 1) {
stopAllSounds();
playing = 0;
} else {
snd3.start(0, 999);
playing = 1;
}
}
Symbol 54 Button
on (release) {
if (pause == 1) {
clearInterval(gameClock);
hitsomething = 1;
pause = 0;
this.attachMovie("pauseClip", "pc", ++d);
pc._x = 230;
pc._y = 330;
} else {
gameClock = setInterval(this, "moveDown", speed);
hitsomething = 0;
pause = 1;
removeMovieClip(pc);
}
}
Symbol 60 Button
on (press) {
prevFrame();
}