Frame 1
MochiAd.showPreGameAd({id:"8bed4c8d847672df", res:"500x600"});
Frame 2
men._visible = false;
btnNew._visible = false;
btnHow._visible = false;
btnAbout._visible = false;
btnEnd._visible = false;
btnCom._visible = false;
btnStr._visible = false;
btnTet._visible = false;
btnBre._visible = false;
var firstFrame = true;
onEnterFrame = function () {
if (firstFrame) {
LoadSound();
firstFrame = false;
}
CheckForKeyStrokes();
};
LoadSound = function () {
stopAllSounds();
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
};
var timer = 0;
var hasSound = true;
var soundTimer = 0;
CheckForKeyStrokes = function () {
timer++;
soundTimer++;
if (timer >= 30) {
tog._alpha = tog._alpha - 10;
}
if (timer == 40) {
tog._visible = false;
}
if (Key.isDown(77) && (soundTimer > 5)) {
if (hasSound) {
stopAllSounds();
hasSound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
hasSound = true;
}
soundTimer = 0;
}
};
Frame 3
if (false) {
}
Frame 100
if (false) {
}
Frame 101
if (false) {
}
Frame 102
if (false) {
}
Frame 103
if (false) {
}
Frame 104
if (false) {
}
Frame 105
if (false) {
}
Frame 120
if (false) {
}
Frame 121
if (false) {
}
Frame 123
stop();
men._visible = false;
btnNew._visible = false;
btnHow._visible = false;
btnAbout._visible = false;
btnEnd._visible = false;
btnCom._visible = false;
btnStr._visible = false;
btnTet._visible = false;
btnBre._visible = false;
var x_accel = 5;
var y_accel = 6;
onEnterFrame = function () {
if (bg2._x > 0) {
bg1._x = bg1._x - x_accel;
bg2._x = bg2._x - x_accel;
bg3._x = bg3._x - x_accel;
bg4._x = bg4._x - x_accel;
}
if (bg2._x == 0) {
bg1._x = 0;
bg2._x = 500;
bg3._x = 0;
bg4._x = 500;
}
if (bg3._y < 0) {
bg1._y = bg1._y + y_accel;
bg2._y = bg2._y + y_accel;
bg3._y = bg3._y + y_accel;
bg4._y = bg4._y + y_accel;
}
if (bg3._y == 0) {
bg1._y = 0;
bg2._y = 0;
bg3._y = -600;
bg4._y = -600;
}
if (tit._x > 223) {
tit._x = tit._x - x_accel;
} else {
tit._x = 223;
}
if (tit._y < 115) {
tit._y = tit._y + 5;
} else {
tit._y = 115;
}
if ((men._y > 250) && (tit._x == 223)) {
men._visible = true;
men._height = men._height + 50;
men._y = men._y - 25;
}
if (men._y <= 250) {
btnNew._visible = true;
btnHow._visible = true;
btnAbout._visible = true;
}
if (str) {
stretch();
}
if (shr) {
shrink();
}
if (fade) {
fading();
}
CheckForKeyStrokes();
};
var str = false;
var shr = false;
stretch = function () {
if (men._height < 350) {
btnAbout._y = btnAbout._y + 50;
btnHow._y = btnHow._y + 50;
men._height = men._height + 50;
} else {
btnEnd._visible = true;
btnCom._visible = true;
btnStr._visible = true;
btnTet._visible = true;
btnBre._visible = true;
str = false;
}
};
shrink = function () {
if (men._height > 200) {
btnAbout._y = btnAbout._y - 50;
btnHow._y = btnHow._y - 50;
men._height = men._height - 50;
} else {
shr = false;
}
};
btnNew.onRelease = function () {
if (men._height < 350) {
str = true;
} else {
shr = true;
btnEnd._visible = false;
btnCom._visible = false;
btnStr._visible = false;
btnTet._visible = false;
btnBre._visible = false;
}
};
btnEnd.onRelease = function () {
fade = true;
dest = 126;
};
btnCom.onRelease = function () {
fade = true;
dest = 127;
};
btnStr.onRelease = function () {
fade = true;
dest = 128;
};
btnTet.onRelease = function () {
fade = true;
dest = 124;
};
btnBre.onRelease = function () {
fade = true;
dest = 125;
};
btnHow.onRelease = function () {
fade = true;
dest = 129;
};
btnAbout.onRelease = function () {
fade = true;
dest = 130;
};
var dest;
var fade = false;
var fadeTime = 0;
fading = function () {
bg1._alpha = bg1._alpha - 10;
bg2._alpha = bg2._alpha - 10;
bg3._alpha = bg3._alpha - 10;
bg4._alpha = bg4._alpha - 10;
men._alpha = men._alpha - 10;
tit._alpha = tit._alpha - 10;
tit1._alpha = tit1._alpha - 10;
btnNew._alpha = btnNew._alpha - 10;
btnEnd._alpha = btnEnd._alpha - 10;
btnCom._alpha = btnCom._alpha - 10;
btnStr._alpha = btnStr._alpha - 10;
btnTet._alpha = btnTet._alpha - 10;
btnBre._alpha = btnBre._alpha - 10;
btnHow._alpha = btnHow._alpha - 10;
btnAbout._alpha = btnAbout._alpha - 10;
fadeTime++;
if (fadeTime == 10) {
gotoAndPlay(dest);
}
};
var timer = 0;
var hasSound = true;
var soundTimer = 0;
CheckForKeyStrokes = function () {
timer++;
soundTimer++;
if (timer >= 30) {
tog._alpha = tog._alpha - 10;
}
if (timer == 40) {
tog._visible = false;
}
if (Key.isDown(77) && (soundTimer > 5)) {
if (hasSound) {
stopAllSounds();
hasSound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
hasSound = true;
}
soundTimer = 0;
}
};
Frame 124
stop();
level = 1;
lines = 0;
score = 0;
prog = "0 / 10";
lblPause._visible = false;
var currentShape;
var nextShape;
var timer = 0;
var interval = 30;
var prevInterval = 30;
var rotTimer = 0;
var moveTimer = 0;
var rot = 0;
var FCOLOR;
var slot = new Array();
var occSlot = new Array();
var names = new Array();
var colors = new Array();
i = 0;
while (i < 150) {
slot[i] = false;
occSlot[i] = false;
names[i] = "";
colors[i] = "";
i++;
}
var num = 0;
xp._width = 0;
var firstFrame = true;
var PAUSE = false;
var PAUSE_TIMER = 0;
var GAME_OVER = false;
onEnterFrame = function () {
if (!GAME_OVER) {
PAUSE_TIMER++;
if (Key.isDown(80) && (PAUSE_TIMER > 5)) {
if (!PAUSE) {
PAUSE = true;
lblPause._visible = true;
} else {
PAUSE = false;
lblPause._visible = false;
}
PAUSE_TIMER = 0;
}
if (!PAUSE) {
if (firstFrame) {
currentShape = Math.round(Math.random() * 6);
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
firstFrame = false;
}
fall();
movement();
}
}
CheckForKeyStrokes();
};
movement = function () {
moveTimer++;
rotTimer++;
if (((((((((Key.isDown(37) && (moveTimer > 3)) && (b1._x != 25)) && (b2._x != 25)) && (b3._x != 25)) && (b4._x != 25)) && (!slot[occSlot[0] - 1])) && (!slot[occSlot[1] - 1])) && (!slot[occSlot[2] - 1])) && (!slot[occSlot[3] - 1])) {
b1._x = b1._x - 30;
b2._x = b2._x - 30;
b3._x = b3._x - 30;
b4._x = b4._x - 30;
i = 0;
while (i < 4) {
occSlot[i]--;
i++;
}
moveTimer = 0;
}
if (((((((((Key.isDown(39) && (moveTimer > 3)) && (b1._x != 295)) && (b2._x != 295)) && (b3._x != 295)) && (b4._x != 295)) && (!slot[occSlot[0] + 1])) && (!slot[occSlot[1] + 1])) && (!slot[occSlot[2] + 1])) && (!slot[occSlot[3] + 1])) {
b1._x = b1._x + 30;
b2._x = b2._x + 30;
b3._x = b3._x + 30;
b4._x = b4._x + 30;
i = 0;
while (i < 4) {
occSlot[i]++;
i++;
}
moveTimer = 0;
}
if (Key.isDown(40)) {
if (interval > 2) {
prevInterval = interval;
}
interval = 2;
} else {
interval = prevInterval;
}
if (Key.isDown(38) && (rotTimer > 5)) {
rotate();
rotTimer = 0;
}
};
fall = function (shape) {
timer++;
if (timer > interval) {
if (((((((((occSlot[0] - 10) >= 0) && ((occSlot[1] - 10) >= 0)) && ((occSlot[2] - 10) >= 0)) && ((occSlot[3] - 10) >= 0)) && (!slot[occSlot[0] - 10])) && (!slot[occSlot[1] - 10])) && (!slot[occSlot[2] - 10])) && (!slot[occSlot[3] - 10])) {
b1._y = b1._y + 30;
b2._y = b2._y + 30;
b3._y = b3._y + 30;
b4._y = b4._y + 30;
i = 0;
while (i < 4) {
occSlot[i] = occSlot[i] - 10;
i++;
}
timer = 0;
} else {
freeze();
}
if (interval == 2) {
score++;
}
}
};
freeze = function () {
i = 0;
while (i < 4) {
slot[occSlot[i]] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
names[occSlot[i]] = "block" + num;
colors[occSlot[i]] = FCOLOR;
_root["block" + num]._x = _root["b" + (i + 1)]._x;
_root["block" + num]._y = _root["b" + (i + 1)]._y;
var _local2 = new Color(_root["block" + num]);
_local2.setRGB(FCOLOR);
num++;
i++;
}
score++;
lineCheck();
currentShape = nextShape;
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
};
var numAnim = 0;
lineCheck = function () {
var _local2 = 0;
var _local3 = false;
i = 0;
while (i < 15) {
x = i * 10;
while (x < ((i * 10) + 10)) {
if (!slot[x]) {
break;
}
if (x == ((i * 10) + 9)) {
t = i * 10;
while (t < ((i * 10) + 10)) {
_root[names[t]].removeMovieClip();
slot[t] = false;
t++;
}
_local2++;
xp._width = xp._width + 30;
gravity(i);
i = -1;
lines++;
score = score + 10;
if ((lines % 10) == 0) {
xp._width = 0;
level++;
_local3 = true;
interval = prevInterval;
interval = interval - 3;
if (interval < 5) {
interval = 5;
}
}
}
x++;
}
i++;
}
removeAnimations();
if (_local3) {
attachMovie("aLevel", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 1) {
attachMovie("single", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 2) {
attachMovie("double", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 3) {
attachMovie("triple", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 4) {
attachMovie("aTetris", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
}
prog = (lines - ((level - 1) * 10)) + " / 10";
};
removeAnimations = function () {
i = 0;
while (i <= numAnim) {
_root["anim" + i].removeMovieClip();
i++;
}
numAnim = 0;
};
gravity = function (line) {
t = (line * 10) + 10;
while (t < 150) {
if (slot[t]) {
_root[names[t]]._y = _root[names[t]]._y + 30;
slot[t] = false;
names[t - 10] = names[t];
names[t] = "";
slot[t - 10] = true;
colors[t - 10] = colors[t];
colors[t] = "";
}
t++;
}
};
rotate = function () {
if (currentShape == 1) {
if (rot == 0) {
if (((((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) && (((occSlot[3] + 18) <= 149) && (!slot[occSlot[3] + 18]))) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
b4._x = b4._x - 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 9;
occSlot[2] = occSlot[2] + 9;
occSlot[3] = occSlot[3] + 18;
rot = 1;
}
} else if (rot == 1) {
if ((((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b1._x != 25)) && (b1._x != 265)) && (b1._x != 295)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 2) {
if (rot == 0) {
if (((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] + 19) <= 149) && (!slot[occSlot[3] + 19]))) {
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 10;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] + 19;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] + 10) >= 0) && (!slot[occSlot[0] + 10])) && (((occSlot[2] + 11) <= 149) && (!slot[occSlot[2] + 11]))) && (((occSlot[3] - 1) >= 0) && (!slot[occSlot[3] - 1]))) && (b2._x != 295)) {
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y - 30;
b4._x = b4._x - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[2] = occSlot[2] + 11;
occSlot[3] = occSlot[3] - 1;
rot = 2;
}
} else if (rot == 2) {
if ((((occSlot[1] - 11) >= 0) && (!slot[occSlot[1] - 11])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) {
b2._x = b2._x - 30;
b2._y = b2._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[1] = occSlot[1] - 11;
occSlot[2] = occSlot[2] + 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[1] + 11) <= 149) && (!slot[occSlot[1] + 11])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b3._x != 295)) {
b2._x = b2._x + 30;
b2._y = b2._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 11;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 3) {
if (rot == 0) {
if ((((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11])) && (((occSlot[3] - 9) >= 0) && (!slot[occSlot[3] - 9]))) {
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x + 30;
b4._y = b4._y + 30;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 9;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[1] - 9) >= 0) && (!slot[occSlot[1] - 9]))) && (((occSlot[3] + 21) <= 149) && (!slot[occSlot[3] + 21]))) && (b2._x != 295)) {
b1._y = b1._y + 30;
b2._x = b2._x + 30;
b2._y = b2._y + 30;
b4._y = b4._y - 60;
b4._x = b4._x + 30;
occSlot[0] = occSlot[0] - 10;
occSlot[1] = occSlot[1] - 9;
occSlot[3] = occSlot[3] + 21;
rot = 2;
}
} else if (rot == 2) {
if (((((occSlot[1] + 8) <= 149) && (!slot[occSlot[1] + 8])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] - 21) >= 0) && (!slot[occSlot[3] - 21]))) {
b2._x = b2._x - 60;
b2._y = b2._y - 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 8;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 21;
rot = 3;
}
} else if (rot == 3) {
if (((((((occSlot[0] + 10) <= 149) && (!slot[occSlot[0] + 10])) && (((occSlot[1] + 1) <= 149) && (!slot[occSlot[1] + 1]))) && (((occSlot[2] + 22) <= 149) && (!slot[occSlot[2] + 22]))) && (((occSlot[3] + 9) <= 149) && (!slot[occSlot[3] + 9]))) && (b4._x != 295)) {
b1._y = b1._y - 30;
b2._x = b2._x + 30;
b3._x = b3._x + 60;
b3._y = b3._y - 60;
b4._x = b4._x - 30;
b4._y = b4._y - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[1] = occSlot[1] + 1;
occSlot[2] = occSlot[2] + 22;
occSlot[3] = occSlot[3] + 9;
rot = 0;
}
}
} else if (currentShape == 4) {
if (rot == 0) {
if (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9])) {
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[2] = occSlot[2] + 9;
rot = 1;
}
} else if (rot == 1) {
if ((((occSlot[3] + 11) <= 159) && (!slot[occSlot[3] + 11])) && (b2._x != 295)) {
b4._x = b4._x + 30;
b4._y = b4._y - 30;
occSlot[3] = occSlot[3] + 11;
rot = 2;
}
} else if (rot == 2) {
if (((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
occSlot[0] = occSlot[0] - 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 11) >= 0) && (!slot[occSlot[3] - 11]))) && (b1._x != 25)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 30;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 11;
rot = 0;
}
}
} else if (currentShape == 5) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[3] + 20) <= 149) && (!slot[occSlot[3] + 20]))) {
b1._x = b1._x + 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[3] = occSlot[3] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[3] - 20) >= 0) && (!slot[occSlot[3] - 20]))) && (b2._x != 25)) {
b1._x = b1._x - 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[3] = occSlot[3] - 20;
rot = 0;
}
}
} else if (currentShape == 6) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[1] + 20) <= 149) && (!slot[occSlot[1] + 20]))) {
b1._x = b1._x + 60;
b2._y = b2._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[1] = occSlot[1] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[1] - 20) >= 0) && (!slot[occSlot[1] - 20]))) && (b3._x != 25)) {
b1._x = b1._x - 60;
b2._y = b2._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[1] = occSlot[1] - 20;
rot = 0;
}
}
}
};
newShape = function (shape) {
if (shape == 0) {
occSlot[0] = 144;
occSlot[1] = 145;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 255;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 145;
b1._y = 75;
b2._x = 175;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 1) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 146;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65280;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 205;
b4._y = 75;
} else if (shape == 2) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711680 /* 0xFF0000 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 175;
b4._y = 105;
} else if (shape == 3) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 133;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16776960 /* 0xFFFF00 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 115;
b4._y = 105;
} else if (shape == 4) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 134;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65535;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 145;
b4._y = 105;
} else if (shape == 5) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711935 /* 0xFF00FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 6) {
occSlot[0] = 133;
occSlot[1] = 134;
occSlot[2] = 144;
occSlot[3] = 145;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 10027263 /* 0x9900FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 105;
b2._x = 145;
b2._y = 105;
b3._x = 145;
b3._y = 75;
b4._x = 175;
b4._y = 75;
}
i = 0;
while (i < 4) {
if (slot[occSlot[i]]) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
break;
}
i++;
}
rot = 0;
timer = 0;
};
showNextShape = function (shape) {
if (shape == 0) {
shapeO._x = 380;
shapeO._y = 120;
} else {
shapeO._x = -500;
shapeO._y = -500;
}
if (shape == 1) {
shapeI._x = 350;
shapeI._y = 135;
} else {
shapeI._x = -500;
shapeI._y = -500;
}
if (shape == 2) {
shapeJ._x = 365;
shapeJ._y = 120;
} else {
shapeJ._x = -500;
shapeJ._y = -500;
}
if (shape == 3) {
shapeL._x = 365;
shapeL._y = 120;
} else {
shapeL._x = -500;
shapeL._y = -500;
}
if (shape == 4) {
shapeT._x = 365;
shapeT._y = 120;
} else {
shapeT._x = -500;
shapeT._y = -500;
}
if (shape == 5) {
shapeZ._x = 365;
shapeZ._y = 120;
} else {
shapeZ._x = -500;
shapeZ._y = -500;
}
if (shape == 6) {
shapeS._x = 365;
shapeS._y = 120;
} else {
shapeS._x = -500;
shapeS._y = -500;
}
};
removeTetris = function () {
i = 0;
while (i < 150) {
if (slot[i]) {
_root[names[i]].removeMovieClip();
names[i] = "";
colors[i] = "";
slot[i] = false;
}
i++;
}
num = 0;
};
btnMenu.onRelease = function () {
removeTetris();
removeAnimations();
_root.gameOver.removeMovieClip();
gotoAndPlay (123);
};
var sound = true;
btnSound.onRelease = function () {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
};
var soundTimer = 0;
CheckForKeyStrokes = function () {
soundTimer++;
if (Key.isDown(77) && (soundTimer > 5)) {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
soundTimer = 0;
}
};
Frame 125
stop();
lblPause._visible = false;
var xBall;
var yBall;
var hasLevel = false;
var isMoving = false;
var num = 0;
var score = 0;
var level = 1;
var lives = 3;
var numBlocks = 0;
var row = 4;
var PAUSE = false;
var PAUSE_TIMER = 0;
var GAME_OVER = false;
numAnim = 0;
onEnterFrame = function () {
if (!GAME_OVER) {
PAUSE_TIMER++;
if (Key.isDown(80) && (PAUSE_TIMER > 5)) {
if (!PAUSE) {
PAUSE = true;
lblPause._visible = true;
} else {
PAUSE = false;
lblPause._visible = false;
}
PAUSE_TIMER = 0;
}
if (!PAUSE) {
if (Key.isDown(32)) {
if (!isMoving) {
xBall = level + 2;
yBall = level + 4;
if (yBall > 10) {
yBall = 10;
}
if (xBall > 10) {
xBall = 10;
}
if (Math.random() < 0.5) {
xBall = xBall * -1;
}
ball._y = ball._y - 1;
isMoving = true;
space._visible = false;
}
}
if (!hasLevel) {
NewLevel();
hasLevel = true;
}
if (numBlocks == 0) {
space._visible = true;
row++;
if (row == 8) {
row = 4;
}
ball._x = paddle._x + 30;
ball._y = paddle._y - 10;
isMoving = false;
score = score + 10;
level++;
lives++;
NewLevel();
}
if (isMoving) {
Move();
CheckCollisions();
}
PaddleMove();
}
}
CheckForKeyStrokes();
};
PaddleMove = function () {
if (Key.isDown(37)) {
paddle._x = paddle._x - 8;
if ((!isMoving) && (paddle._x >= 25)) {
ball._x = ball._x - 8;
}
if (paddle._x < 25) {
paddle._x = 25;
}
}
if (Key.isDown(39)) {
paddle._x = paddle._x + 8;
if ((!isMoving) && (paddle._x <= 255)) {
ball._x = ball._x + 8;
}
if (paddle._x > 255) {
paddle._x = 255;
}
}
};
Move = function () {
ball._x = ball._x + xBall;
ball._y = ball._y - yBall;
if (ball._x < 25) {
ball._x = 25;
xBall = xBall * -1;
}
if (ball._x > 315) {
ball._x = 315;
xBall = xBall * -1;
}
if (ball._y < 75) {
ball._y = 75;
yBall = yBall * -1;
}
if (ball._y > 600) {
ball._x = paddle._x + 30;
ball._y = paddle._y - 10;
lives--;
isMoving = false;
space._visible = true;
if (lives == -1) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
lives++;
space._visible = false;
}
}
if (ball.hitTest(paddle)) {
ball._y = paddle._y - 11;
yBall = yBall * -1;
var _local2 = xBall;
if ((ball._x + 5) < (paddle._x + 35)) {
xBall = ((paddle._x + 35) - (ball._x + 5)) / 5;
if (_local2 < 0) {
xBall = xBall * -1;
}
} else {
xBall = ((ball._x + 5) - (paddle._x + 35)) / 5;
if (_local2 < 0) {
xBall = xBall * -1;
}
}
yBall++;
if (yBall > 10) {
yBall = 10;
}
}
};
NewLevel = function () {
var _local2;
h = 0;
while (h < row) {
w = 0;
while (w < 10) {
attachMovie("block", "block" + num, _root.getNextHighestDepth());
_root["block" + num]._x = (w * 30) + 25;
_root["block" + num]._y = (h * 30) + 75;
if (h == 0) {
_local2 = 255;
} else if (h == 1) {
_local2 = 65280;
} else if (h == 2) {
_local2 = 16711680 /* 0xFF0000 */;
} else if (h == 3) {
_local2 = 16776960 /* 0xFFFF00 */;
} else if (h == 4) {
_local2 = 65535;
} else if (h == 5) {
_local2 = 16711935 /* 0xFF00FF */;
} else if (h == 6) {
_local2 = 10027263 /* 0x9900FF */;
}
var _local3 = new Color(_root["block" + num]);
_local3.setRGB(_local2);
num++;
numBlocks++;
w++;
}
h++;
}
};
CheckCollisions = function () {
i = 0;
while (i <= num) {
if (ball.hitTest(_root["block" + i])) {
var _local4;
var _local5;
var _local3;
var _local2;
if ((ball._x + ball._width) < (_root["block" + i]._x + (_root["block" + i]._width / 2))) {
_local4 = (ball._x + ball._width) - _root["block" + i]._x;
_local3 = true;
} else {
_local4 = (_root["block" + i]._x + _root["block" + i]._width) - ball._x;
_local3 = false;
}
if ((ball._y + ball._height) < (_root["block" + i]._y + (_root["block" + i]._height / 2))) {
_local5 = (ball._y + ball._height) - _root["block" + i]._y;
_local2 = true;
} else {
_local5 = (_root["block" + i]._y + _root["block" + i]._height) - ball._y;
_local2 = false;
}
if (_local4 > _local5) {
if (_local2) {
ball._y = _root["block" + i]._y - ball._height;
} else {
ball._y = _root["block" + i]._y + _root["block" + i]._height;
}
yBall = yBall * -1;
} else {
if (_local3) {
ball._x = _root["block" + i]._x - ball._width;
} else {
ball._x = _root["block" + i]._x + _root["block" + i]._width;
}
xBall = xBall * -1;
}
_root["block" + i].removeMovieClip();
numBlocks--;
score++;
}
i++;
}
};
removeBreakout = function () {
i = 0;
while (i <= num) {
_root["block" + i].removeMovieClip();
i++;
}
};
btnMenu.onRelease = function () {
removeBreakout();
_root.gameOver.removeMovieClip();
gotoAndPlay (123);
};
var sound = true;
btnSound.onRelease = function () {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
};
var soundTimer = 0;
CheckForKeyStrokes = function () {
soundTimer++;
if (Key.isDown(77) && (soundTimer > 5)) {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
soundTimer = 0;
}
};
Frame 126
stop();
level = 1;
lines = 0;
score = 0;
ball._alpha = 0;
paddle._alpha = 0;
txtTime._visible = false;
lblTime._alpha = 0;
space._visible = false;
prog = "0 / 2";
lblPause._visible = false;
var currentShape;
var nextShape;
var timer = 0;
var interval = 30;
var prevInterval = 30;
var rotTimer = 0;
var moveTimer = 0;
var rot = 0;
var COLOR;
var FCOLOR;
var slot = new Array();
var bSlot = new Array();
var occSlot = new Array();
var names = new Array();
var bNames = new Array();
var colors = new Array();
var bColors = new Array();
i = 0;
while (i < 150) {
slot[i] = false;
bSlot[i] = false;
occSlot[i] = false;
names[i] = "";
bNames[i] = "";
colors[i] = "";
bColors[i] = "";
i++;
}
var num = 0;
var bNum = 0;
xp._width = 0;
var firstFrame = true;
var reqLines = 2;
var levelLines = 0;
var tetris = true;
var anim = false;
var breakout = false;
var bAnim = false;
var anim2 = false;
var xBall;
var yBall;
var isMoving = false;
var PAUSE = false;
var PAUSE_TIMER = 0;
var GAME_OVER = false;
onEnterFrame = function () {
if (!GAME_OVER) {
PAUSE_TIMER++;
if (Key.isDown(80) && (PAUSE_TIMER > 5)) {
if (!PAUSE) {
PAUSE = true;
lblPause._visible = true;
} else {
PAUSE = false;
lblPause._visible = false;
}
PAUSE_TIMER = 0;
}
if (!PAUSE) {
if (tetris) {
if (firstFrame) {
currentShape = Math.round(Math.random() * 6);
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
firstFrame = false;
}
fall();
movement();
} else {
b1._visible = false;
b2._visible = false;
b3._visible = false;
b4._visible = false;
}
if (breakout) {
if (Key.isDown(32)) {
if (!isMoving) {
xBall = level + 2;
yBall = level + 4;
if (yBall > 10) {
yBall = 10;
}
if (xBall > 10) {
xBall = 10;
}
if (Math.random() < 0.5) {
xBall = xBall * -1;
}
ball._y = ball._y - 1;
isMoving = true;
space._visible = false;
}
}
if (isMoving) {
Move();
CheckCollisions();
}
PaddleMove();
}
if (anim) {
animate();
}
if (bAnim) {
bAnimate();
}
if (bAnim2) {
bAnimate2();
}
if (anim2) {
animate2();
}
}
}
CheckForKeyStrokes();
};
convertBack = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (bSlot[(q * 10) + w]) {
slot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
_root["block" + num]._alpha = 0;
_root["block" + num]._x = (w * 30) + 25;
_root["block" + num]._y = (q * 30) + 75;
names[(150 - ((q + 1) * 10)) + w] = "block" + num;
var _local2 = new Color("block" + num);
COLOR = bColors[(q * 10) + w];
colors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
num++;
}
w++;
}
q++;
}
};
Move = function () {
ball._x = ball._x + xBall;
ball._y = ball._y - yBall;
if (ball._x < 25) {
ball._x = 25;
xBall = xBall * -1;
}
if (ball._x > 315) {
ball._x = 315;
xBall = xBall * -1;
}
if (ball._y < 75) {
ball._y = 75;
yBall = yBall * -1;
}
if ((ball._y > 600) || (MILI == 0)) {
isMoving = false;
convertBack();
bAnim2 = true;
}
if (ball.hitTest(paddle)) {
ball._y = paddle._y - 11;
yBall = yBall * -1;
var _local1 = xBall;
if ((ball._x + 5) < (paddle._x + 35)) {
xBall = ((paddle._x + 35) - (ball._x + 5)) / 5;
if (_local1 < 0) {
xBall = xBall * -1;
}
} else {
xBall = ((ball._x + 5) - (paddle._x + 35)) / 5;
if (_local1 < 0) {
xBall = xBall * -1;
}
}
yBall++;
if (yBall > 10) {
yBall = 10;
}
}
MILI--;
if ((MILI % 30) == 0) {
time = MILI / 30;
}
};
CheckCollisions = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
if (ball.hitTest(_root[bNames[i]])) {
var _local4;
var _local5;
var _local3;
var _local2;
if ((ball._x + ball._width) < (_root[bNames[i]]._x + (_root[bNames[i]]._width / 2))) {
_local4 = (ball._x + ball._width) - _root[bNames[i]]._x;
_local3 = true;
} else {
_local4 = (_root[bNames[i]]._x + _root[bNames[i]]._width) - ball._x;
_local3 = false;
}
if ((ball._y + ball._height) < (_root[bNames[i]]._y + (_root[bNames[i]]._height / 2))) {
_local5 = (ball._y + ball._height) - _root[bNames[i]]._y;
_local2 = true;
} else {
_local5 = (_root[bNames[i]]._y + _root[bNames[i]]._height) - ball._y;
_local2 = false;
}
if (_local4 > _local5) {
if (_local2) {
ball._y = _root[bNames[i]]._y - ball._height;
} else {
ball._y = _root[bNames[i]]._y + _root[bNames[i]]._height;
}
yBall = yBall * -1;
} else {
if (_local3) {
ball._x = _root[bNames[i]]._x - ball._width;
} else {
ball._x = _root[bNames[i]]._x + _root[bNames[i]]._width;
}
xBall = xBall * -1;
}
bSlot[i] = false;
_root[bNames[i]].removeMovieClip();
numBlocks--;
score++;
a = 0;
while (a < 150) {
if (bSlot[a]) {
break;
}
if (a == 149) {
isMoving = false;
convertBack();
bAnim2 = true;
score = score + 10;
}
a++;
}
}
}
i++;
}
};
PaddleMove = function () {
if (Key.isDown(37)) {
paddle._x = paddle._x - 8;
if ((!isMoving) && (paddle._x >= 25)) {
ball._x = ball._x - 8;
}
if (paddle._x < 25) {
paddle._x = 25;
}
}
if (Key.isDown(39)) {
paddle._x = paddle._x + 8;
if ((!isMoving) && (paddle._x <= 255)) {
ball._x = ball._x + 8;
}
if (paddle._x > 255) {
paddle._x = 255;
}
}
};
animTimer = 0;
animate = function () {
animTimer++;
if (pBar._y > 525) {
pBar._y = pBar._y - 1;
xp._y = xp._y - 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha - 10;
i++;
}
}
xp._alpha = xp._alpha - 10;
shapeI._alpha = shapeI._alpha - 10;
shapeO._alpha = shapeO._alpha - 10;
shapeL._alpha = shapeL._alpha - 10;
shapeJ._alpha = shapeJ._alpha - 10;
shapeS._alpha = shapeS._alpha - 10;
shapeZ._alpha = shapeZ._alpha - 10;
shapeT._alpha = shapeT._alpha - 10;
if (animTimer == 10) {
anim = eval (false)();
convert();
removeTetris();
bAnim = true;
animTimer = 0;
}
};
animate2 = function () {
animTimer++;
if (pBar._y < 535) {
pBar._y = pBar._y + 1;
xp._y = xp._y + 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha + 10;
i++;
}
}
xp._alpha = xp._alpha + 10;
shapeI._alpha = shapeI._alpha + 10;
shapeO._alpha = shapeO._alpha + 10;
shapeL._alpha = shapeL._alpha + 10;
shapeJ._alpha = shapeJ._alpha + 10;
shapeS._alpha = shapeS._alpha + 10;
shapeZ._alpha = shapeZ._alpha + 10;
shapeT._alpha = shapeT._alpha + 10;
if (animTimer == 10) {
anim2 = eval (false)();
tetris = true;
txtProg._visible = true;
animTimer = 0;
b1._visible = true;
b2._visible = true;
b3._visible = true;
b4._visible = true;
}
};
bAnimTimer = 0;
bAnimate = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha + 10;
i++;
}
}
lblTime._alpha = lblTime._alpha + 10;
ball._alpha = ball._alpha + 10;
paddle._alpha = paddle._alpha + 10;
if (bAnimTimer == 10) {
bAnim = false;
breakout = true;
txtTime._visible = true;
space._visible = true;
bAnimTimer = 0;
}
};
bAnimate2 = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha - 10;
i++;
}
}
txtTime._visible = false;
lblTime._alpha = lblTime._alpha - 10;
ball._alpha = ball._alpha - 10;
paddle._alpha = paddle._alpha - 10;
if (bAnimTimer == 10) {
bAnim2 = false;
anim2 = true;
breakout = false;
bAnimTimer = 0;
removeBreakout();
}
};
removeBreakout = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
_root[bNames[i]].removeMovieClip();
bNames[i] = "";
bSlot[i] = false;
}
i++;
}
bNum = 0;
};
convert = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (slot[(q * 10) + w]) {
bSlot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "brick" + bNum, _root.getNextHighestDepth());
_root["brick" + bNum]._alpha = 0;
_root["brick" + bNum]._x = (w * 30) + 25;
_root["brick" + bNum]._y = (q * 30) + 75;
bNames[(150 - ((q + 1) * 10)) + w] = "brick" + bNum;
var _local2 = new Color("brick" + bNum);
COLOR = colors[(q * 10) + w];
bColors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
bNum++;
}
w++;
}
q++;
}
};
movement = function () {
moveTimer++;
rotTimer++;
if (((((((((Key.isDown(37) && (moveTimer > 3)) && (b1._x != 25)) && (b2._x != 25)) && (b3._x != 25)) && (b4._x != 25)) && (!slot[occSlot[0] - 1])) && (!slot[occSlot[1] - 1])) && (!slot[occSlot[2] - 1])) && (!slot[occSlot[3] - 1])) {
b1._x = b1._x - 30;
b2._x = b2._x - 30;
b3._x = b3._x - 30;
b4._x = b4._x - 30;
i = 0;
while (i < 4) {
occSlot[i]--;
i++;
}
moveTimer = 0;
}
if (((((((((Key.isDown(39) && (moveTimer > 3)) && (b1._x != 295)) && (b2._x != 295)) && (b3._x != 295)) && (b4._x != 295)) && (!slot[occSlot[0] + 1])) && (!slot[occSlot[1] + 1])) && (!slot[occSlot[2] + 1])) && (!slot[occSlot[3] + 1])) {
b1._x = b1._x + 30;
b2._x = b2._x + 30;
b3._x = b3._x + 30;
b4._x = b4._x + 30;
i = 0;
while (i < 4) {
occSlot[i]++;
i++;
}
moveTimer = 0;
}
if (Key.isDown(40)) {
if (interval > 2) {
prevInterval = interval;
}
interval = 2;
} else {
interval = prevInterval;
}
if (Key.isDown(38) && (rotTimer > 5)) {
rotate();
rotTimer = 0;
}
};
fall = function (shape) {
timer++;
if (timer > interval) {
if (((((((((occSlot[0] - 10) >= 0) && ((occSlot[1] - 10) >= 0)) && ((occSlot[2] - 10) >= 0)) && ((occSlot[3] - 10) >= 0)) && (!slot[occSlot[0] - 10])) && (!slot[occSlot[1] - 10])) && (!slot[occSlot[2] - 10])) && (!slot[occSlot[3] - 10])) {
b1._y = b1._y + 30;
b2._y = b2._y + 30;
b3._y = b3._y + 30;
b4._y = b4._y + 30;
i = 0;
while (i < 4) {
occSlot[i] = occSlot[i] - 10;
i++;
}
timer = 0;
} else {
freeze();
}
if (interval == 2) {
score++;
}
}
};
freeze = function () {
i = 0;
while (i < 4) {
slot[occSlot[i]] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
names[occSlot[i]] = "block" + num;
colors[occSlot[i]] = FCOLOR;
_root["block" + num]._x = _root["b" + (i + 1)]._x;
_root["block" + num]._y = _root["b" + (i + 1)]._y;
var _local2 = new Color(_root["block" + num]);
_local2.setRGB(FCOLOR);
num++;
i++;
}
score++;
lineCheck();
currentShape = nextShape;
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
};
lineCheck = function () {
var _local2 = 0;
var _local3 = false;
i = 0;
while (i < 15) {
x = i * 10;
while (x < ((i * 10) + 10)) {
if (!slot[x]) {
break;
}
if (x == ((i * 10) + 9)) {
t = i * 10;
while (t < ((i * 10) + 10)) {
_root[names[t]].removeMovieClip();
slot[t] = false;
t++;
}
_local2++;
xp._width = xp._width + (300 / reqLines);
gravity(i);
i = -1;
lines++;
levelLines++;
score = score + 10;
if (levelLines == reqLines) {
xp._width = 0;
_local3 = true;
level++;
interval = prevInterval;
interval = interval - 3;
if (interval < 5) {
interval = 5;
}
levelLines = 0;
reqLines++;
}
}
x++;
}
i++;
}
removeAnimations();
if (_local3) {
i = 0;
while (i < 150) {
if (slot[i]) {
MILI = (level * 150) + 600;
time = MILI / 30;
tetris = false;
ball._x = 170;
ball._y = 530;
paddle._x = 140;
anim = true;
txtProg._visible = false;
break;
}
i++;
}
attachMovie("aLevel", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 1) {
attachMovie("single", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 2) {
attachMovie("double", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 3) {
attachMovie("triple", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 4) {
attachMovie("aTetris", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
}
prog = (levelLines + " / ") + reqLines;
};
removeAnimations = function () {
i = 0;
while (i <= numAnim) {
_root["anim" + i].removeMovieClip();
i++;
}
numAnim = 0;
};
gravity = function (line) {
t = (line * 10) + 10;
while (t < 150) {
if (slot[t]) {
_root[names[t]]._y = _root[names[t]]._y + 30;
slot[t] = false;
names[t - 10] = names[t];
names[t] = "";
slot[t - 10] = true;
colors[t - 10] = colors[t];
colors[t] = "";
}
t++;
}
};
rotate = function () {
if (currentShape == 1) {
if (rot == 0) {
if (((((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) && (((occSlot[3] + 18) <= 149) && (!slot[occSlot[3] + 18]))) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
b4._x = b4._x - 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 9;
occSlot[2] = occSlot[2] + 9;
occSlot[3] = occSlot[3] + 18;
rot = 1;
}
} else if (rot == 1) {
if ((((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b1._x != 25)) && (b1._x != 265)) && (b1._x != 295)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 2) {
if (rot == 0) {
if (((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] + 19) <= 149) && (!slot[occSlot[3] + 19]))) {
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 10;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] + 19;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] + 10) >= 0) && (!slot[occSlot[0] + 10])) && (((occSlot[2] + 11) <= 149) && (!slot[occSlot[2] + 11]))) && (((occSlot[3] - 1) >= 0) && (!slot[occSlot[3] - 1]))) && (b2._x != 295)) {
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y - 30;
b4._x = b4._x - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[2] = occSlot[2] + 11;
occSlot[3] = occSlot[3] - 1;
rot = 2;
}
} else if (rot == 2) {
if ((((occSlot[1] - 11) >= 0) && (!slot[occSlot[1] - 11])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) {
b2._x = b2._x - 30;
b2._y = b2._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[1] = occSlot[1] - 11;
occSlot[2] = occSlot[2] + 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[1] + 11) <= 149) && (!slot[occSlot[1] + 11])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b3._x != 295)) {
b2._x = b2._x + 30;
b2._y = b2._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 11;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 3) {
if (rot == 0) {
if ((((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11])) && (((occSlot[3] - 9) >= 0) && (!slot[occSlot[3] - 9]))) {
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x + 30;
b4._y = b4._y + 30;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 9;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[1] - 9) >= 0) && (!slot[occSlot[1] - 9]))) && (((occSlot[3] + 21) <= 149) && (!slot[occSlot[3] + 21]))) && (b2._x != 295)) {
b1._y = b1._y + 30;
b2._x = b2._x + 30;
b2._y = b2._y + 30;
b4._y = b4._y - 60;
b4._x = b4._x + 30;
occSlot[0] = occSlot[0] - 10;
occSlot[1] = occSlot[1] - 9;
occSlot[3] = occSlot[3] + 21;
rot = 2;
}
} else if (rot == 2) {
if (((((occSlot[1] + 8) <= 149) && (!slot[occSlot[1] + 8])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] - 21) >= 0) && (!slot[occSlot[3] - 21]))) {
b2._x = b2._x - 60;
b2._y = b2._y - 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 8;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 21;
rot = 3;
}
} else if (rot == 3) {
if (((((((occSlot[0] + 10) <= 149) && (!slot[occSlot[0] + 10])) && (((occSlot[1] + 1) <= 149) && (!slot[occSlot[1] + 1]))) && (((occSlot[2] + 22) <= 149) && (!slot[occSlot[2] + 22]))) && (((occSlot[3] + 9) <= 149) && (!slot[occSlot[3] + 9]))) && (b4._x != 295)) {
b1._y = b1._y - 30;
b2._x = b2._x + 30;
b3._x = b3._x + 60;
b3._y = b3._y - 60;
b4._x = b4._x - 30;
b4._y = b4._y - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[1] = occSlot[1] + 1;
occSlot[2] = occSlot[2] + 22;
occSlot[3] = occSlot[3] + 9;
rot = 0;
}
}
} else if (currentShape == 4) {
if (rot == 0) {
if (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9])) {
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[2] = occSlot[2] + 9;
rot = 1;
}
} else if (rot == 1) {
if ((((occSlot[3] + 11) <= 159) && (!slot[occSlot[3] + 11])) && (b2._x != 295)) {
b4._x = b4._x + 30;
b4._y = b4._y - 30;
occSlot[3] = occSlot[3] + 11;
rot = 2;
}
} else if (rot == 2) {
if (((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
occSlot[0] = occSlot[0] - 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 11) >= 0) && (!slot[occSlot[3] - 11]))) && (b1._x != 25)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 30;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 11;
rot = 0;
}
}
} else if (currentShape == 5) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[3] + 20) <= 149) && (!slot[occSlot[3] + 20]))) {
b1._x = b1._x + 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[3] = occSlot[3] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[3] - 20) >= 0) && (!slot[occSlot[3] - 20]))) && (b2._x != 25)) {
b1._x = b1._x - 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[3] = occSlot[3] - 20;
rot = 0;
}
}
} else if (currentShape == 6) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[1] + 20) <= 149) && (!slot[occSlot[1] + 20]))) {
b1._x = b1._x + 60;
b2._y = b2._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[1] = occSlot[1] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[1] - 20) >= 0) && (!slot[occSlot[1] - 20]))) && (b3._x != 25)) {
b1._x = b1._x - 60;
b2._y = b2._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[1] = occSlot[1] - 20;
rot = 0;
}
}
}
};
newShape = function (shape) {
if (shape == 0) {
occSlot[0] = 144;
occSlot[1] = 145;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 255;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 145;
b1._y = 75;
b2._x = 175;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 1) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 146;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65280;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 205;
b4._y = 75;
} else if (shape == 2) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711680 /* 0xFF0000 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 175;
b4._y = 105;
} else if (shape == 3) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 133;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16776960 /* 0xFFFF00 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 115;
b4._y = 105;
} else if (shape == 4) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 134;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65535;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 145;
b4._y = 105;
} else if (shape == 5) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711935 /* 0xFF00FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 6) {
occSlot[0] = 133;
occSlot[1] = 134;
occSlot[2] = 144;
occSlot[3] = 145;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 10027263 /* 0x9900FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 105;
b2._x = 145;
b2._y = 105;
b3._x = 145;
b3._y = 75;
b4._x = 175;
b4._y = 75;
}
i = 0;
while (i < 150) {
if (slot[occSlot[i]]) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
break;
}
i++;
}
rot = 0;
timer = 0;
};
showNextShape = function (shape) {
if (shape == 0) {
shapeO._x = 380;
shapeO._y = 120;
} else {
shapeO._x = -500;
shapeO._y = -500;
}
if (shape == 1) {
shapeI._x = 350;
shapeI._y = 135;
} else {
shapeI._x = -500;
shapeI._y = -500;
}
if (shape == 2) {
shapeJ._x = 365;
shapeJ._y = 120;
} else {
shapeJ._x = -500;
shapeJ._y = -500;
}
if (shape == 3) {
shapeL._x = 365;
shapeL._y = 120;
} else {
shapeL._x = -500;
shapeL._y = -500;
}
if (shape == 4) {
shapeT._x = 365;
shapeT._y = 120;
} else {
shapeT._x = -500;
shapeT._y = -500;
}
if (shape == 5) {
shapeZ._x = 365;
shapeZ._y = 120;
} else {
shapeZ._x = -500;
shapeZ._y = -500;
}
if (shape == 6) {
shapeS._x = 365;
shapeS._y = 120;
} else {
shapeS._x = -500;
shapeS._y = -500;
}
};
removeTetris = function () {
i = 0;
while (i < 150) {
if (slot[i]) {
_root[names[i]].removeMovieClip();
names[i] = "";
colors[i] = "";
slot[i] = false;
}
i++;
}
num = 0;
};
var numAnim = 0;
btnMenu.onRelease = function () {
removeTetris();
removeAnimations();
removeBreakout();
_root.gameOver.removeMovieClip();
gotoAndPlay (123);
};
var sound = true;
btnSound.onRelease = function () {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
};
var soundTimer = 0;
CheckForKeyStrokes = function () {
soundTimer++;
if (Key.isDown(77) && (soundTimer > 5)) {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
soundTimer = 0;
}
};
Frame 127
stop();
level = 1;
lines = 0;
score = 0;
ball._alpha = 0;
paddle._alpha = 0;
txtTime._visible = false;
lblTime._alpha = 0;
space._visible = false;
prog = "0 / 2";
lives = 3;
txtLives._visible = false;
lblLives._alpha = 0;
lblPause._visible = false;
var currentShape;
var nextShape;
var timer = 0;
var interval = 30;
var prevInterval = 30;
var rotTimer = 0;
var moveTimer = 0;
var rot = 0;
var COLOR;
var FCOLOR;
var slot = new Array();
var bSlot = new Array();
var occSlot = new Array();
var names = new Array();
var bNames = new Array();
var colors = new Array();
var bColors = new Array();
i = 0;
while (i < 150) {
slot[i] = false;
bSlot[i] = false;
occSlot[i] = false;
names[i] = "";
bNames[i] = "";
colors[i] = "";
bColors[i] = "";
i++;
}
var num = 0;
var bNum = 0;
xp._width = 0;
var firstFrame = true;
var reqLines = 2;
var levelLines = 0;
var tetris = true;
var anim = false;
var breakout = false;
var bAnim = false;
var anim2 = false;
var xBall;
var yBall;
var isMoving = false;
var PAUSE = false;
var PAUSE_TIMER = 0;
var GAME_OVER = false;
onEnterFrame = function () {
if (!GAME_OVER) {
PAUSE_TIMER++;
if (Key.isDown(80) && (PAUSE_TIMER > 5)) {
if (!PAUSE) {
PAUSE = true;
lblPause._visible = true;
} else {
PAUSE = false;
lblPause._visible = false;
}
PAUSE_TIMER = 0;
}
if (!PAUSE) {
if (tetris) {
if (firstFrame) {
currentShape = Math.round(Math.random() * 6);
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
firstFrame = false;
}
fall();
movement();
} else {
b1._visible = false;
b2._visible = false;
b3._visible = false;
b4._visible = false;
}
if (breakout) {
if (Key.isDown(32)) {
if (!isMoving) {
xBall = level + 3;
yBall = level + 5;
if (yBall > 10) {
yBall = 10;
}
if (xBall > 10) {
xBall = 10;
}
if (Math.random() < 0.5) {
xBall = xBall * -1;
}
ball._y = ball._y - 1;
isMoving = true;
space._visible = false;
}
}
if (isMoving) {
Move();
CheckCollisions();
}
PaddleMove();
}
if (anim) {
animate();
}
if (bAnim) {
bAnimate();
}
if (bAnim2) {
bAnimate2();
}
if (anim2) {
animate2();
}
}
}
CheckForKeyStrokes();
};
convertBack = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (bSlot[(q * 10) + w]) {
slot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
_root["block" + num]._alpha = 0;
_root["block" + num]._x = (w * 30) + 25;
_root["block" + num]._y = (q * 30) + 75;
names[(150 - ((q + 1) * 10)) + w] = "block" + num;
var _local2 = new Color("block" + num);
COLOR = bColors[(q * 10) + w];
colors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
num++;
}
w++;
}
q++;
}
};
Move = function () {
ball._x = ball._x + xBall;
ball._y = ball._y - yBall;
if (ball._x < 25) {
ball._x = 25;
xBall = xBall * -1;
}
if (ball._x > 315) {
ball._x = 315;
xBall = xBall * -1;
}
if (ball._y < 75) {
ball._y = 75;
yBall = yBall * -1;
}
if (ball._y > 600) {
ball._x = paddle._x + 30;
ball._y = paddle._y - 10;
lives--;
isMoving = false;
space._visible = true;
if (lives == -1) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
lives++;
space._visible = false;
}
}
if (ball.hitTest(paddle)) {
ball._y = paddle._y - 11;
yBall = yBall * -1;
var _local2 = xBall;
if ((ball._x + 5) < (paddle._x + 35)) {
xBall = ((paddle._x + 35) - (ball._x + 5)) / 5;
if (_local2 < 0) {
xBall = xBall * -1;
}
} else {
xBall = ((ball._x + 5) - (paddle._x + 35)) / 5;
if (_local2 < 0) {
xBall = xBall * -1;
}
}
yBall++;
if (yBall > 10) {
yBall = 10;
}
}
};
CheckCollisions = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
if (ball.hitTest(_root[bNames[i]])) {
var _local4;
var _local5;
var _local3;
var _local2;
if ((ball._x + ball._width) < (_root[bNames[i]]._x + (_root[bNames[i]]._width / 2))) {
_local4 = (ball._x + ball._width) - _root[bNames[i]]._x;
_local3 = true;
} else {
_local4 = (_root[bNames[i]]._x + _root[bNames[i]]._width) - ball._x;
_local3 = false;
}
if ((ball._y + ball._height) < (_root[bNames[i]]._y + (_root[bNames[i]]._height / 2))) {
_local5 = (ball._y + ball._height) - _root[bNames[i]]._y;
_local2 = true;
} else {
_local5 = (_root[bNames[i]]._y + _root[bNames[i]]._height) - ball._y;
_local2 = false;
}
if (_local4 > _local5) {
if (_local2) {
ball._y = _root[bNames[i]]._y - ball._height;
} else {
ball._y = _root[bNames[i]]._y + _root[bNames[i]]._height;
}
yBall = yBall * -1;
} else {
if (_local3) {
ball._x = _root[bNames[i]]._x - ball._width;
} else {
ball._x = _root[bNames[i]]._x + _root[bNames[i]]._width;
}
xBall = xBall * -1;
}
bSlot[i] = false;
_root[bNames[i]].removeMovieClip();
numBlocks--;
score++;
a = 0;
while (a < 150) {
if (bSlot[a]) {
break;
}
if (a == 149) {
isMoving = false;
convertBack();
bAnim2 = true;
score = score + 10;
level++;
removeAnimations();
attachMovie("aLevel", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
if ((level % 3) == 0) {
lives++;
}
}
a++;
}
}
}
i++;
}
};
var numAnim = 0;
PaddleMove = function () {
if (Key.isDown(37)) {
paddle._x = paddle._x - 8;
if ((!isMoving) && (paddle._x >= 25)) {
ball._x = ball._x - 8;
}
if (paddle._x < 25) {
paddle._x = 25;
}
}
if (Key.isDown(39)) {
paddle._x = paddle._x + 8;
if ((!isMoving) && (paddle._x <= 255)) {
ball._x = ball._x + 8;
}
if (paddle._x > 255) {
paddle._x = 255;
}
}
};
animTimer = 0;
animate = function () {
animTimer++;
if (pBar._y > 525) {
pBar._y = pBar._y - 1;
xp._y = xp._y - 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha - 10;
i++;
}
}
xp._alpha = xp._alpha - 10;
shapeI._alpha = shapeI._alpha - 10;
shapeO._alpha = shapeO._alpha - 10;
shapeL._alpha = shapeL._alpha - 10;
shapeJ._alpha = shapeJ._alpha - 10;
shapeS._alpha = shapeS._alpha - 10;
shapeZ._alpha = shapeZ._alpha - 10;
shapeT._alpha = shapeT._alpha - 10;
if (animTimer == 10) {
anim = eval (false)();
convert();
removeTetris();
bAnim = true;
animTimer = 0;
}
};
animate2 = function () {
animTimer++;
if (pBar._y < 535) {
pBar._y = pBar._y + 1;
xp._y = xp._y + 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha + 10;
i++;
}
}
xp._alpha = xp._alpha + 10;
shapeI._alpha = shapeI._alpha + 10;
shapeO._alpha = shapeO._alpha + 10;
shapeL._alpha = shapeL._alpha + 10;
shapeJ._alpha = shapeJ._alpha + 10;
shapeS._alpha = shapeS._alpha + 10;
shapeZ._alpha = shapeZ._alpha + 10;
shapeT._alpha = shapeT._alpha + 10;
if (animTimer == 10) {
anim2 = eval (false)();
tetris = true;
txtProg._visible = true;
animTimer = 0;
b1._visible = true;
b2._visible = true;
b3._visible = true;
b4._visible = true;
}
};
bAnimTimer = 0;
bAnimate = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha + 10;
i++;
}
}
lblLives._alpha = lblLives._alpha + 10;
ball._alpha = ball._alpha + 10;
paddle._alpha = paddle._alpha + 10;
if (bAnimTimer == 10) {
bAnim = false;
breakout = true;
txtLives._visible = true;
space._visible = true;
bAnimTimer = 0;
}
};
bAnimate2 = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha - 10;
i++;
}
}
txtLives._visible = false;
lblLives._alpha = lblLives._alpha - 10;
ball._alpha = ball._alpha - 10;
paddle._alpha = paddle._alpha - 10;
if (bAnimTimer == 10) {
bAnim2 = false;
anim2 = true;
breakout = false;
bAnimTimer = 0;
removeBreakout();
}
};
removeBreakout = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
_root[bNames[i]].removeMovieClip();
bNames[i] = "";
bSlot[i] = false;
}
i++;
}
bNum = 0;
};
convert = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (slot[(q * 10) + w]) {
bSlot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "brick" + bNum, _root.getNextHighestDepth());
_root["brick" + bNum]._alpha = 0;
_root["brick" + bNum]._x = (w * 30) + 25;
_root["brick" + bNum]._y = (q * 30) + 75;
bNames[(150 - ((q + 1) * 10)) + w] = "brick" + bNum;
var _local2 = new Color("brick" + bNum);
COLOR = colors[(q * 10) + w];
bColors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
bNum++;
}
w++;
}
q++;
}
};
movement = function () {
moveTimer++;
rotTimer++;
if (((((((((Key.isDown(37) && (moveTimer > 3)) && (b1._x != 25)) && (b2._x != 25)) && (b3._x != 25)) && (b4._x != 25)) && (!slot[occSlot[0] - 1])) && (!slot[occSlot[1] - 1])) && (!slot[occSlot[2] - 1])) && (!slot[occSlot[3] - 1])) {
b1._x = b1._x - 30;
b2._x = b2._x - 30;
b3._x = b3._x - 30;
b4._x = b4._x - 30;
i = 0;
while (i < 4) {
occSlot[i]--;
i++;
}
moveTimer = 0;
}
if (((((((((Key.isDown(39) && (moveTimer > 3)) && (b1._x != 295)) && (b2._x != 295)) && (b3._x != 295)) && (b4._x != 295)) && (!slot[occSlot[0] + 1])) && (!slot[occSlot[1] + 1])) && (!slot[occSlot[2] + 1])) && (!slot[occSlot[3] + 1])) {
b1._x = b1._x + 30;
b2._x = b2._x + 30;
b3._x = b3._x + 30;
b4._x = b4._x + 30;
i = 0;
while (i < 4) {
occSlot[i]++;
i++;
}
moveTimer = 0;
}
if (Key.isDown(40)) {
if (interval > 2) {
prevInterval = interval;
}
interval = 2;
} else {
interval = prevInterval;
}
if (Key.isDown(38) && (rotTimer > 5)) {
rotate();
rotTimer = 0;
}
};
fall = function (shape) {
timer++;
if (timer > interval) {
if (((((((((occSlot[0] - 10) >= 0) && ((occSlot[1] - 10) >= 0)) && ((occSlot[2] - 10) >= 0)) && ((occSlot[3] - 10) >= 0)) && (!slot[occSlot[0] - 10])) && (!slot[occSlot[1] - 10])) && (!slot[occSlot[2] - 10])) && (!slot[occSlot[3] - 10])) {
b1._y = b1._y + 30;
b2._y = b2._y + 30;
b3._y = b3._y + 30;
b4._y = b4._y + 30;
i = 0;
while (i < 4) {
occSlot[i] = occSlot[i] - 10;
i++;
}
timer = 0;
} else {
freeze();
}
if (interval == 2) {
score++;
}
}
};
freeze = function () {
i = 0;
while (i < 4) {
slot[occSlot[i]] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
names[occSlot[i]] = "block" + num;
colors[occSlot[i]] = FCOLOR;
_root["block" + num]._x = _root["b" + (i + 1)]._x;
_root["block" + num]._y = _root["b" + (i + 1)]._y;
var _local2 = new Color(_root["block" + num]);
_local2.setRGB(FCOLOR);
num++;
i++;
}
score++;
lineCheck();
currentShape = nextShape;
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
};
lineCheck = function () {
var _local3 = false;
var _local2 = 0;
i = 0;
while (i < 15) {
x = i * 10;
while (x < ((i * 10) + 10)) {
if (!slot[x]) {
break;
}
if (x == ((i * 10) + 9)) {
t = i * 10;
while (t < ((i * 10) + 10)) {
_root[names[t]].removeMovieClip();
slot[t] = false;
t++;
}
_local2++;
xp._width = xp._width + (300 / reqLines);
gravity(i);
i = -1;
lines++;
levelLines++;
score = score + 10;
if (levelLines == reqLines) {
xp._width = 0;
interval = prevInterval;
interval = interval - 3;
_local3 = true;
if (interval < 5) {
interval = 5;
}
levelLines = 0;
reqLines++;
}
}
x++;
}
i++;
}
removeAnimations();
if (_local3) {
i = 0;
while (i < 150) {
if (slot[i]) {
tetris = false;
ball._x = 170;
ball._y = 530;
paddle._x = 140;
anim = true;
txtProg._visible = false;
break;
}
if (i == 149) {
level++;
}
i++;
}
}
if (_local2 == 1) {
attachMovie("single", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 2) {
attachMovie("double", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 3) {
attachMovie("triple", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 4) {
attachMovie("aTetris", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
}
prog = (levelLines + " / ") + reqLines;
};
removeAnimations = function () {
i = 0;
while (i <= numAnim) {
_root["anim" + i].removeMovieClip();
i++;
}
numAnim = 0;
};
gravity = function (line) {
t = (line * 10) + 10;
while (t < 150) {
if (slot[t]) {
_root[names[t]]._y = _root[names[t]]._y + 30;
slot[t] = false;
names[t - 10] = names[t];
names[t] = "";
slot[t - 10] = true;
colors[t - 10] = colors[t];
colors[t] = "";
}
t++;
}
};
rotate = function () {
if (currentShape == 1) {
if (rot == 0) {
if (((((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) && (((occSlot[3] + 18) <= 149) && (!slot[occSlot[3] + 18]))) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
b4._x = b4._x - 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 9;
occSlot[2] = occSlot[2] + 9;
occSlot[3] = occSlot[3] + 18;
rot = 1;
}
} else if (rot == 1) {
if ((((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b1._x != 25)) && (b1._x != 265)) && (b1._x != 295)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 2) {
if (rot == 0) {
if (((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] + 19) <= 149) && (!slot[occSlot[3] + 19]))) {
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 10;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] + 19;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] + 10) >= 0) && (!slot[occSlot[0] + 10])) && (((occSlot[2] + 11) <= 149) && (!slot[occSlot[2] + 11]))) && (((occSlot[3] - 1) >= 0) && (!slot[occSlot[3] - 1]))) && (b2._x != 295)) {
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y - 30;
b4._x = b4._x - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[2] = occSlot[2] + 11;
occSlot[3] = occSlot[3] - 1;
rot = 2;
}
} else if (rot == 2) {
if ((((occSlot[1] - 11) >= 0) && (!slot[occSlot[1] - 11])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) {
b2._x = b2._x - 30;
b2._y = b2._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[1] = occSlot[1] - 11;
occSlot[2] = occSlot[2] + 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[1] + 11) <= 149) && (!slot[occSlot[1] + 11])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b3._x != 295)) {
b2._x = b2._x + 30;
b2._y = b2._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 11;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 3) {
if (rot == 0) {
if ((((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11])) && (((occSlot[3] - 9) >= 0) && (!slot[occSlot[3] - 9]))) {
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x + 30;
b4._y = b4._y + 30;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 9;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[1] - 9) >= 0) && (!slot[occSlot[1] - 9]))) && (((occSlot[3] + 21) <= 149) && (!slot[occSlot[3] + 21]))) && (b2._x != 295)) {
b1._y = b1._y + 30;
b2._x = b2._x + 30;
b2._y = b2._y + 30;
b4._y = b4._y - 60;
b4._x = b4._x + 30;
occSlot[0] = occSlot[0] - 10;
occSlot[1] = occSlot[1] - 9;
occSlot[3] = occSlot[3] + 21;
rot = 2;
}
} else if (rot == 2) {
if (((((occSlot[1] + 8) <= 149) && (!slot[occSlot[1] + 8])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] - 21) >= 0) && (!slot[occSlot[3] - 21]))) {
b2._x = b2._x - 60;
b2._y = b2._y - 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 8;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 21;
rot = 3;
}
} else if (rot == 3) {
if (((((((occSlot[0] + 10) <= 149) && (!slot[occSlot[0] + 10])) && (((occSlot[1] + 1) <= 149) && (!slot[occSlot[1] + 1]))) && (((occSlot[2] + 22) <= 149) && (!slot[occSlot[2] + 22]))) && (((occSlot[3] + 9) <= 149) && (!slot[occSlot[3] + 9]))) && (b4._x != 295)) {
b1._y = b1._y - 30;
b2._x = b2._x + 30;
b3._x = b3._x + 60;
b3._y = b3._y - 60;
b4._x = b4._x - 30;
b4._y = b4._y - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[1] = occSlot[1] + 1;
occSlot[2] = occSlot[2] + 22;
occSlot[3] = occSlot[3] + 9;
rot = 0;
}
}
} else if (currentShape == 4) {
if (rot == 0) {
if (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9])) {
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[2] = occSlot[2] + 9;
rot = 1;
}
} else if (rot == 1) {
if ((((occSlot[3] + 11) <= 159) && (!slot[occSlot[3] + 11])) && (b2._x != 295)) {
b4._x = b4._x + 30;
b4._y = b4._y - 30;
occSlot[3] = occSlot[3] + 11;
rot = 2;
}
} else if (rot == 2) {
if (((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
occSlot[0] = occSlot[0] - 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 11) >= 0) && (!slot[occSlot[3] - 11]))) && (b1._x != 25)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 30;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 11;
rot = 0;
}
}
} else if (currentShape == 5) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[3] + 20) <= 149) && (!slot[occSlot[3] + 20]))) {
b1._x = b1._x + 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[3] = occSlot[3] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[3] - 20) >= 0) && (!slot[occSlot[3] - 20]))) && (b2._x != 25)) {
b1._x = b1._x - 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[3] = occSlot[3] - 20;
rot = 0;
}
}
} else if (currentShape == 6) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[1] + 20) <= 149) && (!slot[occSlot[1] + 20]))) {
b1._x = b1._x + 60;
b2._y = b2._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[1] = occSlot[1] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[1] - 20) >= 0) && (!slot[occSlot[1] - 20]))) && (b3._x != 25)) {
b1._x = b1._x - 60;
b2._y = b2._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[1] = occSlot[1] - 20;
rot = 0;
}
}
}
};
newShape = function (shape) {
if (shape == 0) {
occSlot[0] = 144;
occSlot[1] = 145;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 255;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 145;
b1._y = 75;
b2._x = 175;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 1) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 146;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65280;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 205;
b4._y = 75;
} else if (shape == 2) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711680 /* 0xFF0000 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 175;
b4._y = 105;
} else if (shape == 3) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 133;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16776960 /* 0xFFFF00 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 115;
b4._y = 105;
} else if (shape == 4) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 134;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65535;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 145;
b4._y = 105;
} else if (shape == 5) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711935 /* 0xFF00FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 6) {
occSlot[0] = 133;
occSlot[1] = 134;
occSlot[2] = 144;
occSlot[3] = 145;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 10027263 /* 0x9900FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 105;
b2._x = 145;
b2._y = 105;
b3._x = 145;
b3._y = 75;
b4._x = 175;
b4._y = 75;
}
i = 0;
while (i < 4) {
if (slot[occSlot[i]]) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
break;
}
i++;
}
rot = 0;
timer = 0;
};
showNextShape = function (shape) {
if (shape == 0) {
shapeO._x = 380;
shapeO._y = 120;
} else {
shapeO._x = -500;
shapeO._y = -500;
}
if (shape == 1) {
shapeI._x = 350;
shapeI._y = 135;
} else {
shapeI._x = -500;
shapeI._y = -500;
}
if (shape == 2) {
shapeJ._x = 365;
shapeJ._y = 120;
} else {
shapeJ._x = -500;
shapeJ._y = -500;
}
if (shape == 3) {
shapeL._x = 365;
shapeL._y = 120;
} else {
shapeL._x = -500;
shapeL._y = -500;
}
if (shape == 4) {
shapeT._x = 365;
shapeT._y = 120;
} else {
shapeT._x = -500;
shapeT._y = -500;
}
if (shape == 5) {
shapeZ._x = 365;
shapeZ._y = 120;
} else {
shapeZ._x = -500;
shapeZ._y = -500;
}
if (shape == 6) {
shapeS._x = 365;
shapeS._y = 120;
} else {
shapeS._x = -500;
shapeS._y = -500;
}
};
removeTetris = function () {
i = 0;
while (i < 150) {
if (slot[i]) {
_root[names[i]].removeMovieClip();
names[i] = "";
colors[i] = "";
slot[i] = false;
}
i++;
}
num = 0;
};
btnMenu.onRelease = function () {
removeTetris();
removeAnimations();
removeBreakout();
GAME_OVER = true;
_root.gameOver.removeMovieClip();
gotoAndPlay (123);
};
var sound = true;
btnSound.onRelease = function () {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
};
var soundTimer = 0;
CheckForKeyStrokes = function () {
soundTimer++;
if (Key.isDown(77) && (soundTimer > 5)) {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
soundTimer = 0;
}
};
Frame 128
stop();
level = 1;
lines = 0;
score = 0;
var balls = 1;
ball._alpha = 0;
paddle._alpha = 0;
space._visible = false;
prog = "0 / 10";
lblPause._visible = false;
holder.gotoAndStop(2);
var currentShape;
var nextShape;
var timer = 0;
var interval = 30;
var prevInterval = 30;
var rotTimer = 0;
var moveTimer = 0;
var rot = 0;
var COLOR;
var FCOLOR;
var slot = new Array();
var bSlot = new Array();
var occSlot = new Array();
var names = new Array();
var bNames = new Array();
var colors = new Array();
var bColors = new Array();
i = 0;
while (i < 150) {
slot[i] = false;
bSlot[i] = false;
occSlot[i] = false;
names[i] = "";
bNames[i] = "";
colors[i] = "";
bColors[i] = "";
i++;
}
var num = 0;
var bNum = 0;
xp._width = 0;
var firstFrame = true;
var tetris = true;
var anim = false;
var breakout = false;
var bAnim = false;
var anim2 = false;
var xBall;
var yBall;
var isMoving = false;
var PAUSE = false;
var PAUSE_TIMER = 0;
var GAME_OVER = false;
var bTimer = 0;
var BT = true;
onEnterFrame = function () {
if (!GAME_OVER) {
PAUSE_TIMER++;
if (Key.isDown(80) && (PAUSE_TIMER > 5)) {
if (!PAUSE) {
PAUSE = true;
lblPause._visible = true;
} else {
PAUSE = false;
lblPause._visible = false;
}
PAUSE_TIMER = 0;
}
if (!PAUSE) {
if (tetris) {
if (firstFrame) {
currentShape = Math.round(Math.random() * 6);
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
firstFrame = false;
}
fall();
movement();
if (Key.isDown(66) && (balls > 0)) {
i = 0;
while (i < 150) {
if (slot[i]) {
ball._x = 170;
ball._y = 530;
paddle._x = 140;
tetris = false;
anim = true;
balls--;
txtProg._visible = false;
holder.gotoAndStop(balls + 1);
break;
}
i++;
}
}
} else {
b1._visible = false;
b2._visible = false;
b3._visible = false;
b4._visible = false;
}
if (breakout) {
if (Key.isDown(32)) {
if (!isMoving) {
xBall = level + 3;
yBall = level + 5;
if (yBall > 10) {
yBall = 10;
}
if (xBall > 10) {
xBall = 10;
}
if (Math.random() < 0.5) {
xBall = xBall * -1;
}
ball._y = ball._y - 1;
isMoving = true;
space._visible = false;
}
}
if (isMoving) {
Move();
CheckCollisions();
}
PaddleMove();
}
if (anim) {
animate();
}
if (bAnim) {
bAnimate();
}
if (bAnim2) {
bAnimate2();
}
if (anim2) {
animate2();
}
}
}
CheckForKeyStrokes();
if (BT) {
bTimer++;
if ((bTimer > 60) && (bTimer < 101)) {
bTo._alpha = bTo._alpha - 5;
} else if (bTimer == 100) {
bTo._y = -500;
bTimer = 0;
BT = false;
}
}
};
convertBack = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (bSlot[(q * 10) + w]) {
slot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
_root["block" + num]._alpha = 0;
_root["block" + num]._x = (w * 30) + 25;
_root["block" + num]._y = (q * 30) + 75;
names[(150 - ((q + 1) * 10)) + w] = "block" + num;
var _local2 = new Color("block" + num);
COLOR = bColors[(q * 10) + w];
colors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
num++;
}
w++;
}
q++;
}
};
Move = function () {
ball._x = ball._x + xBall;
ball._y = ball._y - yBall;
if (ball._x < 25) {
ball._x = 25;
xBall = xBall * -1;
}
if (ball._x > 315) {
ball._x = 315;
xBall = xBall * -1;
}
if (ball._y < 75) {
ball._y = 75;
yBall = yBall * -1;
}
if (ball._y > 600) {
isMoving = false;
convertBack();
bAnim2 = true;
score = score + 10;
}
if (ball.hitTest(paddle)) {
ball._y = paddle._y - 11;
yBall = yBall * -1;
var _local1 = xBall;
if ((ball._x + 5) < (paddle._x + 35)) {
xBall = ((paddle._x + 35) - (ball._x + 5)) / 5;
if (_local1 < 0) {
xBall = xBall * -1;
}
} else {
xBall = ((ball._x + 5) - (paddle._x + 35)) / 5;
if (_local1 < 0) {
xBall = xBall * -1;
}
}
yBall++;
if (yBall > 10) {
yBall = 10;
}
}
};
CheckCollisions = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
if (ball.hitTest(_root[bNames[i]])) {
var _local4;
var _local5;
var _local3;
var _local2;
if ((ball._x + ball._width) < (_root[bNames[i]]._x + (_root[bNames[i]]._width / 2))) {
_local4 = (ball._x + ball._width) - _root[bNames[i]]._x;
_local3 = true;
} else {
_local4 = (_root[bNames[i]]._x + _root[bNames[i]]._width) - ball._x;
_local3 = false;
}
if ((ball._y + ball._height) < (_root[bNames[i]]._y + (_root[bNames[i]]._height / 2))) {
_local5 = (ball._y + ball._height) - _root[bNames[i]]._y;
_local2 = true;
} else {
_local5 = (_root[bNames[i]]._y + _root[bNames[i]]._height) - ball._y;
_local2 = false;
}
if (_local4 > _local5) {
if (_local2) {
ball._y = _root[bNames[i]]._y - ball._height;
} else {
ball._y = _root[bNames[i]]._y + _root[bNames[i]]._height;
}
yBall = yBall * -1;
} else {
if (_local3) {
ball._x = _root[bNames[i]]._x - ball._width;
} else {
ball._x = _root[bNames[i]]._x + _root[bNames[i]]._width;
}
xBall = xBall * -1;
}
bSlot[i] = false;
_root[bNames[i]].removeMovieClip();
numBlocks--;
score++;
a = 0;
while (a < 150) {
if (bSlot[a]) {
break;
}
if (a == 149) {
isMoving = false;
convertBack();
bAnim2 = true;
score = score + 10;
}
a++;
}
}
}
i++;
}
};
PaddleMove = function () {
if (Key.isDown(37)) {
paddle._x = paddle._x - 8;
if ((!isMoving) && (paddle._x >= 25)) {
ball._x = ball._x - 8;
}
if (paddle._x < 25) {
paddle._x = 25;
}
}
if (Key.isDown(39)) {
paddle._x = paddle._x + 8;
if ((!isMoving) && (paddle._x <= 255)) {
ball._x = ball._x + 8;
}
if (paddle._x > 255) {
paddle._x = 255;
}
}
};
animTimer = 0;
animate = function () {
animTimer++;
if (pBar._y > 525) {
pBar._y = pBar._y - 1;
xp._y = xp._y - 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha - 10;
i++;
}
}
xp._alpha = xp._alpha - 10;
shapeI._alpha = shapeI._alpha - 10;
shapeO._alpha = shapeO._alpha - 10;
shapeL._alpha = shapeL._alpha - 10;
shapeJ._alpha = shapeJ._alpha - 10;
shapeS._alpha = shapeS._alpha - 10;
shapeZ._alpha = shapeZ._alpha - 10;
shapeT._alpha = shapeT._alpha - 10;
if (animTimer == 10) {
anim = eval (false)();
convert();
removeTetris();
bAnim = true;
animTimer = 0;
}
};
animate2 = function () {
animTimer++;
if (pBar._y < 535) {
pBar._y = pBar._y + 1;
xp._y = xp._y + 1;
}
if (num < 150) {
i = 0;
while (i <= num) {
_root["block" + i]._alpha = _root["block" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[names[i]]._alpha = _root[names[i]]._alpha + 10;
i++;
}
}
xp._alpha = xp._alpha + 10;
shapeI._alpha = shapeI._alpha + 10;
shapeO._alpha = shapeO._alpha + 10;
shapeL._alpha = shapeL._alpha + 10;
shapeJ._alpha = shapeJ._alpha + 10;
shapeS._alpha = shapeS._alpha + 10;
shapeZ._alpha = shapeZ._alpha + 10;
shapeT._alpha = shapeT._alpha + 10;
if (animTimer == 10) {
anim2 = eval (false)();
tetris = true;
txtProg._visible = true;
animTimer = 0;
b1._visible = true;
b2._visible = true;
b3._visible = true;
b4._visible = true;
}
};
bAnimTimer = 0;
bAnimate = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha + 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha + 10;
i++;
}
}
lblLives._alpha = lblLives._alpha + 10;
ball._alpha = ball._alpha + 10;
paddle._alpha = paddle._alpha + 10;
if (bAnimTimer == 10) {
bAnim = false;
breakout = true;
txtLives._visible = true;
space._visible = true;
bAnimTimer = 0;
}
};
bAnimate2 = function () {
bAnimTimer++;
if (bNum < 150) {
i = 0;
while (i <= bNum) {
_root["brick" + i]._alpha = _root["brick" + i]._alpha - 10;
i++;
}
} else {
i = 0;
while (i < 150) {
_root[bNames[i]]._alpha = _root[bNames[i]]._alpha - 10;
i++;
}
}
txtLives._visible = false;
lblLives._alpha = lblLives._alpha - 10;
ball._alpha = ball._alpha - 10;
paddle._alpha = paddle._alpha - 10;
if (bAnimTimer == 10) {
bAnim2 = false;
anim2 = true;
breakout = false;
bAnimTimer = 0;
removeBreakout();
}
};
removeBreakout = function () {
i = 0;
while (i < 150) {
if (bSlot[i]) {
_root[bNames[i]].removeMovieClip();
bNames[i] = "";
bSlot[i] = false;
}
i++;
}
bNum = 0;
};
convert = function () {
q = 0;
while (q < 15) {
w = 0;
while (w < 10) {
if (slot[(q * 10) + w]) {
bSlot[(150 - ((q + 1) * 10)) + w] = true;
attachMovie("block", "brick" + bNum, _root.getNextHighestDepth());
_root["brick" + bNum]._alpha = 0;
_root["brick" + bNum]._x = (w * 30) + 25;
_root["brick" + bNum]._y = (q * 30) + 75;
bNames[(150 - ((q + 1) * 10)) + w] = "brick" + bNum;
var _local2 = new Color("brick" + bNum);
COLOR = colors[(q * 10) + w];
bColors[(150 - ((q + 1) * 10)) + w] = COLOR;
_local2.setRGB(COLOR);
bNum++;
}
w++;
}
q++;
}
};
movement = function () {
moveTimer++;
rotTimer++;
if (((((((((Key.isDown(37) && (moveTimer > 3)) && (b1._x != 25)) && (b2._x != 25)) && (b3._x != 25)) && (b4._x != 25)) && (!slot[occSlot[0] - 1])) && (!slot[occSlot[1] - 1])) && (!slot[occSlot[2] - 1])) && (!slot[occSlot[3] - 1])) {
b1._x = b1._x - 30;
b2._x = b2._x - 30;
b3._x = b3._x - 30;
b4._x = b4._x - 30;
i = 0;
while (i < 4) {
occSlot[i]--;
i++;
}
moveTimer = 0;
}
if (((((((((Key.isDown(39) && (moveTimer > 3)) && (b1._x != 295)) && (b2._x != 295)) && (b3._x != 295)) && (b4._x != 295)) && (!slot[occSlot[0] + 1])) && (!slot[occSlot[1] + 1])) && (!slot[occSlot[2] + 1])) && (!slot[occSlot[3] + 1])) {
b1._x = b1._x + 30;
b2._x = b2._x + 30;
b3._x = b3._x + 30;
b4._x = b4._x + 30;
i = 0;
while (i < 4) {
occSlot[i]++;
i++;
}
moveTimer = 0;
}
if (Key.isDown(40)) {
if (interval > 2) {
prevInterval = interval;
}
interval = 2;
} else {
interval = prevInterval;
}
if (Key.isDown(38) && (rotTimer > 5)) {
rotate();
rotTimer = 0;
}
};
fall = function (shape) {
timer++;
if (timer > interval) {
if (((((((((occSlot[0] - 10) >= 0) && ((occSlot[1] - 10) >= 0)) && ((occSlot[2] - 10) >= 0)) && ((occSlot[3] - 10) >= 0)) && (!slot[occSlot[0] - 10])) && (!slot[occSlot[1] - 10])) && (!slot[occSlot[2] - 10])) && (!slot[occSlot[3] - 10])) {
b1._y = b1._y + 30;
b2._y = b2._y + 30;
b3._y = b3._y + 30;
b4._y = b4._y + 30;
i = 0;
while (i < 4) {
occSlot[i] = occSlot[i] - 10;
i++;
}
timer = 0;
} else {
freeze();
}
if (interval == 2) {
score++;
}
}
};
freeze = function () {
i = 0;
while (i < 4) {
slot[occSlot[i]] = true;
attachMovie("block", "block" + num, _root.getNextHighestDepth());
names[occSlot[i]] = "block" + num;
colors[occSlot[i]] = FCOLOR;
_root["block" + num]._x = _root["b" + (i + 1)]._x;
_root["block" + num]._y = _root["b" + (i + 1)]._y;
var _local2 = new Color(_root["block" + num]);
_local2.setRGB(FCOLOR);
num++;
i++;
}
score++;
lineCheck();
currentShape = nextShape;
newShape(currentShape);
nextShape = Math.round(Math.random() * 6);
showNextShape(nextShape);
};
var numAnim = 0;
lineCheck = function () {
removeAnimations();
var _local3 = false;
var _local2 = 0;
i = 0;
while (i < 15) {
x = i * 10;
while (x < ((i * 10) + 10)) {
if (!slot[x]) {
break;
}
if (x == ((i * 10) + 9)) {
t = i * 10;
while (t < ((i * 10) + 10)) {
_root[names[t]].removeMovieClip();
slot[t] = false;
t++;
}
_local2++;
xp._width = xp._width + 30;
gravity(i);
i = -1;
lines++;
score = score + 10;
if ((lines % 10) == 0) {
_local3 = true;
level++;
xp._width = 0;
interval = prevInterval;
interval = interval - 3;
if (interval < 5) {
interval = 5;
}
balls++;
if (balls <= 3) {
attachMovie("aBall", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 385;
numAnim++;
}
if (balls > 3) {
balls = 3;
}
holder.gotoAndStop(balls + 1);
}
}
x++;
}
i++;
}
if (_local3) {
attachMovie("aLevel", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 1) {
attachMovie("single", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 2) {
attachMovie("double", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 3) {
attachMovie("triple", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
} else if (_local2 == 4) {
attachMovie("aTetris", "anim" + numAnim, _root.getNextHighestDepth());
_root["anim" + numAnim]._x = 25;
_root["anim" + numAnim]._y = 345;
numAnim++;
}
prog = (lines - ((level - 1) * 10)) + " / 10";
};
removeAnimations = function () {
i = 0;
while (i <= numAnim) {
_root["anim" + i].removeMovieClip();
i++;
}
numAnim = 0;
};
gravity = function (line) {
t = (line * 10) + 10;
while (t < 150) {
if (slot[t]) {
_root[names[t]]._y = _root[names[t]]._y + 30;
slot[t] = false;
names[t - 10] = names[t];
names[t] = "";
slot[t - 10] = true;
colors[t - 10] = colors[t];
colors[t] = "";
}
t++;
}
};
rotate = function () {
if (currentShape == 1) {
if (rot == 0) {
if (((((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) && (((occSlot[3] + 18) <= 149) && (!slot[occSlot[3] + 18]))) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
b4._x = b4._x - 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 9;
occSlot[2] = occSlot[2] + 9;
occSlot[3] = occSlot[3] + 18;
rot = 1;
}
} else if (rot == 1) {
if ((((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b1._x != 25)) && (b1._x != 265)) && (b1._x != 295)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 2) {
if (rot == 0) {
if (((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] + 19) <= 149) && (!slot[occSlot[3] + 19]))) {
b1._y = b1._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] - 10;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] + 19;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] + 10) >= 0) && (!slot[occSlot[0] + 10])) && (((occSlot[2] + 11) <= 149) && (!slot[occSlot[2] + 11]))) && (((occSlot[3] - 1) >= 0) && (!slot[occSlot[3] - 1]))) && (b2._x != 295)) {
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y - 30;
b4._x = b4._x - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[2] = occSlot[2] + 11;
occSlot[3] = occSlot[3] - 1;
rot = 2;
}
} else if (rot == 2) {
if ((((occSlot[1] - 11) >= 0) && (!slot[occSlot[1] - 11])) && (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9]))) {
b2._x = b2._x - 30;
b2._y = b2._y + 30;
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[1] = occSlot[1] - 11;
occSlot[2] = occSlot[2] + 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[1] + 11) <= 149) && (!slot[occSlot[1] + 11])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 18) >= 0) && (!slot[occSlot[3] - 18]))) && (b3._x != 295)) {
b2._x = b2._x + 30;
b2._y = b2._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x + 60;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 11;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 18;
rot = 0;
}
}
} else if (currentShape == 3) {
if (rot == 0) {
if ((((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11])) && (((occSlot[3] - 9) >= 0) && (!slot[occSlot[3] - 9]))) {
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x + 30;
b4._y = b4._y + 30;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 9;
rot = 1;
}
} else if (rot == 1) {
if ((((((occSlot[0] - 10) >= 0) && (!slot[occSlot[0] - 10])) && (((occSlot[1] - 9) >= 0) && (!slot[occSlot[1] - 9]))) && (((occSlot[3] + 21) <= 149) && (!slot[occSlot[3] + 21]))) && (b2._x != 295)) {
b1._y = b1._y + 30;
b2._x = b2._x + 30;
b2._y = b2._y + 30;
b4._y = b4._y - 60;
b4._x = b4._x + 30;
occSlot[0] = occSlot[0] - 10;
occSlot[1] = occSlot[1] - 9;
occSlot[3] = occSlot[3] + 21;
rot = 2;
}
} else if (rot == 2) {
if (((((occSlot[1] + 8) <= 149) && (!slot[occSlot[1] + 8])) && (((occSlot[2] - 11) >= 0) && (!slot[occSlot[2] - 11]))) && (((occSlot[3] - 21) >= 0) && (!slot[occSlot[3] - 21]))) {
b2._x = b2._x - 60;
b2._y = b2._y - 30;
b3._x = b3._x - 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 60;
occSlot[1] = occSlot[1] + 8;
occSlot[2] = occSlot[2] - 11;
occSlot[3] = occSlot[3] - 21;
rot = 3;
}
} else if (rot == 3) {
if (((((((occSlot[0] + 10) <= 149) && (!slot[occSlot[0] + 10])) && (((occSlot[1] + 1) <= 149) && (!slot[occSlot[1] + 1]))) && (((occSlot[2] + 22) <= 149) && (!slot[occSlot[2] + 22]))) && (((occSlot[3] + 9) <= 149) && (!slot[occSlot[3] + 9]))) && (b4._x != 295)) {
b1._y = b1._y - 30;
b2._x = b2._x + 30;
b3._x = b3._x + 60;
b3._y = b3._y - 60;
b4._x = b4._x - 30;
b4._y = b4._y - 30;
occSlot[0] = occSlot[0] + 10;
occSlot[1] = occSlot[1] + 1;
occSlot[2] = occSlot[2] + 22;
occSlot[3] = occSlot[3] + 9;
rot = 0;
}
}
} else if (currentShape == 4) {
if (rot == 0) {
if (((occSlot[2] + 9) <= 149) && (!slot[occSlot[2] + 9])) {
b3._x = b3._x - 30;
b3._y = b3._y - 30;
occSlot[2] = occSlot[2] + 9;
rot = 1;
}
} else if (rot == 1) {
if ((((occSlot[3] + 11) <= 159) && (!slot[occSlot[3] + 11])) && (b2._x != 295)) {
b4._x = b4._x + 30;
b4._y = b4._y - 30;
occSlot[3] = occSlot[3] + 11;
rot = 2;
}
} else if (rot == 2) {
if (((occSlot[0] - 9) >= 0) && (!slot[occSlot[0] - 9])) {
b1._x = b1._x + 30;
b1._y = b1._y + 30;
occSlot[0] = occSlot[0] - 9;
rot = 3;
}
} else if (rot == 3) {
if ((((((occSlot[0] + 9) <= 149) && (!slot[occSlot[0] + 9])) && (((occSlot[2] - 9) >= 0) && (!slot[occSlot[2] - 9]))) && (((occSlot[3] - 11) >= 0) && (!slot[occSlot[3] - 11]))) && (b1._x != 25)) {
b1._x = b1._x - 30;
b1._y = b1._y - 30;
b3._x = b3._x + 30;
b3._y = b3._y + 30;
b4._x = b4._x - 30;
b4._y = b4._y + 30;
occSlot[0] = occSlot[0] + 9;
occSlot[2] = occSlot[2] - 9;
occSlot[3] = occSlot[3] - 11;
rot = 0;
}
}
} else if (currentShape == 5) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[3] + 20) <= 149) && (!slot[occSlot[3] + 20]))) {
b1._x = b1._x + 60;
b4._y = b4._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[3] = occSlot[3] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[3] - 20) >= 0) && (!slot[occSlot[3] - 20]))) && (b2._x != 25)) {
b1._x = b1._x - 60;
b4._y = b4._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[3] = occSlot[3] - 20;
rot = 0;
}
}
} else if (currentShape == 6) {
if (rot == 0) {
if ((((occSlot[0] + 2) <= 149) && (!slot[occSlot[0] + 2])) && (((occSlot[1] + 20) <= 149) && (!slot[occSlot[1] + 20]))) {
b1._x = b1._x + 60;
b2._y = b2._y - 60;
occSlot[0] = occSlot[0] + 2;
occSlot[1] = occSlot[1] + 20;
rot = 1;
}
} else if (rot == 1) {
if (((((occSlot[0] - 2) >= 0) && (!slot[occSlot[0] - 2])) && (((occSlot[1] - 20) >= 0) && (!slot[occSlot[1] - 20]))) && (b3._x != 25)) {
b1._x = b1._x - 60;
b2._y = b2._y + 60;
occSlot[0] = occSlot[0] - 2;
occSlot[1] = occSlot[1] - 20;
rot = 0;
}
}
}
};
newShape = function (shape) {
if (shape == 0) {
occSlot[0] = 144;
occSlot[1] = 145;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 255;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 145;
b1._y = 75;
b2._x = 175;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 1) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 146;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65280;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 205;
b4._y = 75;
} else if (shape == 2) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711680 /* 0xFF0000 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 175;
b4._y = 105;
} else if (shape == 3) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 133;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16776960 /* 0xFFFF00 */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 115;
b4._y = 105;
} else if (shape == 4) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 145;
occSlot[3] = 134;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 65535;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 175;
b3._y = 75;
b4._x = 145;
b4._y = 105;
} else if (shape == 5) {
occSlot[0] = 143;
occSlot[1] = 144;
occSlot[2] = 134;
occSlot[3] = 135;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 16711935 /* 0xFF00FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 75;
b2._x = 145;
b2._y = 75;
b3._x = 145;
b3._y = 105;
b4._x = 175;
b4._y = 105;
} else if (shape == 6) {
occSlot[0] = 133;
occSlot[1] = 134;
occSlot[2] = 144;
occSlot[3] = 145;
i = 1;
while (i <= 4) {
var _local2 = new Color("b" + i);
FCOLOR = 10027263 /* 0x9900FF */;
_local2.setRGB(FCOLOR);
i++;
}
b1._x = 115;
b1._y = 105;
b2._x = 145;
b2._y = 105;
b3._x = 145;
b3._y = 75;
b4._x = 175;
b4._y = 75;
}
i = 0;
while (i < 4) {
if (slot[occSlot[i]]) {
GAME_OVER = true;
attachMovie("gameOver", "gameOver", _root.getNextHighestDepth());
_root.gameOver._x = 25;
_root.gameOver._y = 105;
break;
}
i++;
}
rot = 0;
timer = 0;
};
showNextShape = function (shape) {
if (shape == 0) {
shapeO._x = 380;
shapeO._y = 120;
} else {
shapeO._x = -500;
shapeO._y = -500;
}
if (shape == 1) {
shapeI._x = 350;
shapeI._y = 135;
} else {
shapeI._x = -500;
shapeI._y = -500;
}
if (shape == 2) {
shapeJ._x = 365;
shapeJ._y = 120;
} else {
shapeJ._x = -500;
shapeJ._y = -500;
}
if (shape == 3) {
shapeL._x = 365;
shapeL._y = 120;
} else {
shapeL._x = -500;
shapeL._y = -500;
}
if (shape == 4) {
shapeT._x = 365;
shapeT._y = 120;
} else {
shapeT._x = -500;
shapeT._y = -500;
}
if (shape == 5) {
shapeZ._x = 365;
shapeZ._y = 120;
} else {
shapeZ._x = -500;
shapeZ._y = -500;
}
if (shape == 6) {
shapeS._x = 365;
shapeS._y = 120;
} else {
shapeS._x = -500;
shapeS._y = -500;
}
};
removeTetris = function () {
i = 0;
while (i < 150) {
if (slot[i]) {
_root[names[i]].removeMovieClip();
names[i] = "";
colors[i] = "";
slot[i] = false;
}
i++;
}
num = 0;
};
btnMenu.onRelease = function () {
_root.gameOver.removeMovieClip();
removeAnimations();
removeTetris();
removeBreakout();
gotoAndPlay (123);
};
var sound = true;
btnSound.onRelease = function () {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
};
var soundTimer = 0;
CheckForKeyStrokes = function () {
soundTimer++;
if (Key.isDown(77) && (soundTimer > 5)) {
if (sound) {
stopAllSounds();
sound = false;
} else {
var _local1 = new Sound();
_local1.attachSound("mus");
_local1.start(1.5, 9999);
sound = true;
}
soundTimer = 0;
}
};
Frame 129
stop();
btnMenu.onRelease = function () {
gotoAndPlay (123);
};
Frame 130
stop();
onEnterFrame = function () {
CheckForKeyStrokes();
};
btnMenu.onRelease = function () {
gotoAndPlay (123);
};
Symbol 5 MovieClip [aBall] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._y = this._y - 4;
this._alpha = this._alpha - 5;
}
};
Symbol 8 MovieClip [aLevel] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._y = this._y - 4;
this._alpha = this._alpha - 5;
}
};
Symbol 11 MovieClip [aTetris] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._x = this._x - 2;
this._y = this._y - 3;
this._width = this._width + 1;
this._height = this._height + 1;
this._alpha = this._alpha - 5;
}
};
Symbol 14 MovieClip [triple] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._x = this._x - 2;
this._y = this._y - 1;
this._width = this._width + 1;
this._alpha = this._alpha - 5;
}
};
Symbol 17 MovieClip [double] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._y = this._y - 1;
this._alpha = this._alpha - 5;
}
};
Symbol 19 MovieClip [single] Frame 1
var timer = 0;
onEnterFrame = function () {
timer++;
if (timer <= 20) {
this._y = this._y - 1;
this._alpha = this._alpha - 5;
}
};
Symbol 185 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.7");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 33 MovieClip Frame 1
Symbol 39 MovieClip Frame 1
Symbol 135 MovieClip Frame 1
Symbol 148 MovieClip Frame 1
Symbol 157 MovieClip Frame 1
Symbol 164 MovieClip Frame 1
Symbol 175 MovieClip Frame 1