Frame 1
_highquality = 0;
stop();
Frame 2
score = 0;
level = 0;
lines = 0;
stop();
Instance of Symbol 31 MovieClip in Frame 2
onClipEvent (load) {
function NewShape() {
currentshape = nextshape;
nextshape = Math.round(Math.random() * 6);
a = 1;
while (a < 3) {
b = 0;
while (b < 4) {
eval ((("_root.nr" + a) + "c") + b).gotoAndStop(1);
b++;
}
a++;
}
if (nextshape == 1) {
xstart = 1;
} else {
xstart = 0;
}
if (((nextshape == 0) || (nextshape == 4)) || (nextshape == 6)) {
ystart = 0;
} else {
ystart = 1;
}
a = 0;
while (a < shapes[nextshape].length) {
b = 0;
while (b < 4) {
if (shapes[nextshape][a][b]) {
eval ((("_root.nr" + (a + ystart)) + "c") + (b + xstart)).gotoAndStop(shapes[nextshape][a][b]);
}
b++;
}
a++;
}
xpos = Math.floor((12 - shapes[currentshape][0].length) / 2);
ypos = 0;
oldx = xpos;
oldy = ypos;
rotation = 0;
this.activeShape = new Array();
a = 0;
while (a < shapes[currentshape].length) {
activeShape[a] = new Array();
b = 0;
while (b < shapes[currentshape][a].length) {
activeshape[a][b] = shapes[currentshape][a][b];
b++;
}
a++;
}
}
function DrawShape(xpos, ypos, shp, shape) {
a = 0;
while (a < shp.length) {
b = 0;
while (b < shp[a].length) {
if (shp[a][b] > 1) {
if (shape == 5) {
eval ((("r" + (a + ypos)) + "c") + (b + xpos))._rotation = rotation;
}
eval ((("r" + (a + ypos)) + "c") + (b + xpos)).gotoAndStop(shp[a][b]);
}
thisx++;
b++;
}
a++;
}
}
function FlushShape(xpos, ypos, shp) {
a = 0;
while (a < shp.length) {
b = 0;
while (b < shp[a].length) {
if (shp[a][b] > 1) {
eval ((("r" + (a + ypos)) + "c") + (b + xpos))._rotation = 0;
eval ((("r" + (a + ypos)) + "c") + (b + xpos)).gotoAndStop(1);
}
thisx++;
b++;
}
a++;
}
}
function CheckLeftCol(xpos, ypos, shp) {
y = shp.length - 1;
while (y >= 0) {
x = 0;
while (x < shp[0].length) {
if (((eval ((("r" + (y + ypos)) + "c") + ((x + xpos) - 1))._currentframe > 1) && (shp[y][x] != 1)) && ((shp[y][x - 1] == 1) || (!shp[y][x - 1]))) {
return(true);
}
x++;
}
y--;
}
}
function CheckRightCol(xpos, ypos, shp) {
y = shp.length - 1;
while (y >= 0) {
x = 0;
while (x < shp[0].length) {
if (((eval ((("r" + (y + ypos)) + "c") + ((x + xpos) + 1))._currentframe > 1) && (shp[y][x] != 1)) && ((shp[y][x + 1] == 1) || (!shp[y][x + 1]))) {
return(true);
}
x++;
}
y--;
}
}
function CheckDropCol(xpos, ypos, shape) {
y = activeShape.length - 1;
while (y >= 0) {
x = 0;
while (x < activeShape[0].length) {
if (((eval ((("r" + ((y + ypos) + 1)) + "c") + (x + xpos))._currentframe > 1) && (activeShape[y][x] != 1)) && ((activeShape[y + 1][x] == 1) || (!activeShape[y + 1]))) {
return(true);
}
x++;
}
y--;
}
}
function CheckRotate(xpos, ypos, shp) {
y = 0;
while (y < shp.length) {
x = 0;
while (x < shp[y].length) {
if ((eval ((("r" + (y + ypos)) + "c") + (x + xpos))._currentframe > 1) && (shp[y][x] != 1)) {
return(true);
}
x++;
}
y++;
}
}
function CheckFullRows() {
deadlines = new Array();
linesgone = 0;
var y = 0;
while (y < 18) {
xtotal = 0;
var x = 1;
while (x < 11) {
if (eval ((("r" + y) + "c") + x)._currentframe > 1) {
xtotal++;
}
x++;
}
if (xtotal == 10) {
deadlines[linesgone] = y;
linesgone++;
_root.lines++;
}
y++;
}
if (linesgone > 0) {
return(deadlines);
}
sfx.attachSound("land");
sfx.start();
NewShape();
dropkeyrelease = true;
dropkey = false;
return(false);
}
function RemoveRows(rows) {
deadlines = new Array();
linesgone = 0;
var y = 0;
while (y < 18) {
xtotal = 0;
var x = 1;
while (x < 11) {
if (eval ((("r" + y) + "c") + x)._currentframe == 1) {
xtotal++;
}
x++;
}
if (xtotal == 10) {
zy = y;
while (zy >= 0) {
zx = 1;
while (zx < 11) {
if (zy == 0) {
eval ((("r" + zy) + "c") + zx).gotoAndStop(1);
eval ((("r" + zy) + "c") + zx)._rotation = 0;
} else {
eval ((("r" + zy) + "c") + zx).gotoAndStop(eval ((("r" + (zy - 1)) + "c") + zx)._currentframe);
eval ((("r" + zy) + "c") + zx)._rotation = eval ((("r" + (zy - 1)) + "c") + zx)._rotation;
}
zx++;
}
zy--;
}
}
y++;
}
if (Math.floor(_root.lines / 10) > _root.level) {
_root.level++;
sfx.attachSound("level");
sfx.start();
dropspeed = 44 - (_root.level * 4);
} else {
sfx.attachSound("rowdrop");
sfx.start();
}
}
function RotateShape(xpos, ypos, shape, dir) {
FlushShape(xpos, ypos, activeShape);
tmpShape = new Array();
a = 0;
while (a < activeShape[0].length) {
tmpShape[a] = new Array();
a++;
}
ny = 0;
nx = 0;
if (dir == 1) {
x = 0;
while (x < activeShape[0].length) {
y = activeShape.length - 1;
while (y >= 0) {
tmpShape[ny][nx] = activeShape[y][x];
nx++;
y--;
}
ny++;
nx = 0;
x++;
}
} else {
x = activeShape[0].length - 1;
while (x >= 0) {
y = 0;
while (y < activeShape.length) {
tmpShape[ny][nx] = activeShape[y][x];
nx++;
y++;
}
ny++;
nx = 0;
x--;
}
}
hitside = false;
if (shape == 5) {
if (activeShape.length == 4) {
tmpx = 1;
} else {
tmpx = -1;
}
} else {
tmpx = 0;
}
if (CheckLeftCol((xpos + 1) - tmpx, ypos, tmpShape)) {
hitside = true;
}
if (!hitside) {
if (shape == 5) {
if (activeShape.length == 4) {
tmpx = 1;
} else {
tmpx = -1;
}
} else {
tmpx = 0;
}
if (CheckRightCol((xpos - 1) - tmpx, ypos, tmpShape)) {
hitside = true;
}
}
if (!hitside) {
if (shape == 5) {
if (tmpShape.length == 4) {
tmpy = -2;
tmpx = 1;
} else {
tmpy = 2;
tmpx = -1;
}
} else if ((shape == 2) || (shape == 3)) {
if (tmpShape.length == 3) {
tmpy = -1;
} else {
tmpy = 1;
}
} else {
tmpx = 0;
tmpy = 0;
}
if (CheckRotate(xpos + tmpx, ypos + tmpy, tmpShape)) {
hitside = true;
}
}
if (!hitside) {
activeShape = tmpShape;
sfx.stop("rotate");
sfx.attachSound("rotate");
sfx.start();
if (shape == 5) {
if (dir == 1) {
rotation = rotation + 90;
} else {
rotation = rotation - 90;
}
if (activeShape.length == 4) {
ypos = ypos - 2;
xpos++;
} else {
ypos = ypos + 2;
xpos--;
}
oldy = ypos;
oldx = xpos;
this.ypos = ypos;
this.oldy = ypos;
this.xpos = xpos;
this.oldx = xpos;
}
if ((shape == 2) || (shape == 3)) {
if (activeShape.length == 3) {
ypos--;
} else {
ypos++;
}
oldy = ypos;
this.ypos = ypos;
this.oldy = ypos;
}
}
DrawShape(xpos, ypos, activeShape, shape);
}
var xpos = 3;
var ypos = 0;
var oldx = 0;
var oldy = 0;
var dropspeed = (44 - (_root.level * 4));
var currentshape = 0;
var rotation = 0;
var rotclckwise = false;
var rotcntclckwise = false;
var rotcntclckdone = false;
var rotclckdone = false;
var nextshape = Math.round(Math.random() * 6);
var dropkey = false;
var dropkeyrelease = false;
var dropkeytimer = 0;
var right = false;
var left = false;
var righttimer = 0;
var lefttimer = 0;
var deadlines = false;
var oldblocks = false;
sfx = new Sound();
sequence = new Array("musica1", "musica1", "musica2");
musicpos = 0;
music = new Sound();
music.attachSound("musica1");
music.onSoundComplete = function () {
musicpos++;
if (musicpos == sequence.length) {
musicpos = 0;
}
music.attachSound(sequence[musicpos]);
music.start();
};
music.start();
shapes = new Array();
shapes[0] = new Array(Array(1, 1, 1), Array(10, 10, 10), Array(1, 10, 1));
shapes[1] = new Array(Array(2, 2), Array(2, 2));
shapes[2] = new Array(Array(3, 3, 1), Array(1, 3, 3));
shapes[3] = new Array(Array(1, 9, 9), Array(9, 9, 1));
shapes[4] = new Array(Array(1, 1, 1), Array(4, 4, 4), Array(4, 1, 1));
shapes[5] = new Array(Array(5, 6, 6, 7));
shapes[6] = new Array(Array(1, 1, 1), Array(8, 8, 8), Array(1, 1, 8));
c = 1;
a = 0;
while (a < 19) {
b = 0;
while (b < 12) {
attachMovie("block", (("r" + a) + "c") + b, c);
obj = eval ((("r" + a) + "c") + b);
obj._x = (b * 16) - 8;
obj._y = 8 + (a * 16);
c++;
b++;
}
a++;
}
a = 0;
while (a < 12) {
eval ("r18c" + a).gotoAndStop(2);
eval ("r18c" + a)._visible = false;
a++;
}
a = 0;
while (a < 19) {
eval (("r" + a) + "c0").gotoAndStop(2);
eval (("r" + a) + "c0")._visible = false;
a++;
}
a = 0;
while (a < 19) {
eval (("r" + a) + "c11").gotoAndStop(2);
eval (("r" + a) + "c11")._visible = false;
a++;
}
NewShape();
}
onClipEvent (keyDown) {
if ((Key.getCode() == 90) && (!rotclckwise)) {
rotclckwise = true;
}
if ((Key.getCode() == 88) && (!rotcntclckwise)) {
rotcntclckwise = true;
}
if ((Key.getCode() == 39) && (!right)) {
right = true;
righttimer = 18;
if ((!CheckRightCol(xpos, ypos, activeShape)) && (!CheckRightCol(oldx, oldy, activeShape))) {
xpos++;
sfx.stop("move");
sfx.attachSound("move");
sfx.start();
}
}
if ((Key.getCode() == 37) && (!left)) {
left = true;
lefttimer = 18;
if ((!CheckLeftCol(xpos, ypos, activeShape)) && (!CheckLeftCol(oldx, oldy, activeShape))) {
xpos--;
sfx.stop("move");
sfx.attachSound("move");
sfx.start();
}
}
if (((Key.getCode() == 40) && (!dropkey)) && (!dropkeyrelease)) {
timer = dropspeed;
dropkey = true;
dropkeytimer = 2;
}
}
onClipEvent (keyUp) {
if (Key.getCode() == 90) {
rotclckwise = false;
rotclckdone = false;
}
if (Key.getCode() == 88) {
rotcntclckwise = false;
rotcntclckdone = false;
}
if (Key.getCode() == 40) {
dropkey = false;
dropkeytimer = 0;
dropkeyrelease = false;
dropscore = 0;
}
if (Key.getCode() == 39) {
right = false;
righttimer = 0;
}
if (Key.getCode() == 37) {
left = false;
lefttimer = 0;
}
}
onClipEvent (enterFrame) {
if (!deadlines) {
if (dropkey) {
dropkeytimer--;
if (dropkeytimer == 0) {
timer = dropspeed;
dropkeytimer = 2;
}
}
timer++;
if (_root.level < 11) {
if (timer >= dropspeed) {
if (!CheckDropCol(oldx, oldy, currentshape)) {
ypos++;
if (dropkey) {
dropscore++;
}
} else {
_root.score = _root.score + dropscore;
dropscore = 0;
deadlines = CheckFullRows();
}
timer = 0;
}
} else {
if (timer < 2) {
if (!CheckDropCol(oldx, oldy, currentshape)) {
ypos++;
if (dropkey) {
dropscore++;
}
} else {
_root.score = _root.score + dropscore;
dropscore = 0;
deadlines = CheckFullRows();
}
}
if (timer >= (44 / _root.level)) {
timer = 0;
}
}
FlushShape(oldx, oldy, activeShape);
if (right) {
righttimer--;
if (righttimer == 1) {
if ((!CheckRightCol(xpos, ypos, activeShape)) && (!CheckRightCol(oldx, oldy, activeShape))) {
xpos++;
sfx.stop("move");
sfx.attachSound("move");
sfx.start();
}
righttimer = 6;
}
}
if (left) {
lefttimer--;
if (lefttimer == 1) {
if ((!CheckLeftCol(xpos, ypos, activeShape)) && (!CheckLeftCol(oldx, oldy, activeShape))) {
xpos--;
sfx.stop("move");
sfx.attachSound("move");
sfx.start();
}
lefttimer = 6;
}
}
if (rotclckwise && (!rotclckdone)) {
RotateShape(xpos, ypos, currentshape, 0);
rotclckdone = true;
}
if (rotcntclckwise && (!rotcntclckdone)) {
RotateShape(xpos, ypos, currentshape, 1);
rotcntclckdone = true;
}
DrawShape(xpos, ypos, activeShape, currentshape);
oldx = xpos;
oldy = ypos;
} else {
if (!oldblocks) {
oldblocks = new Array();
var y = 0;
while (y < deadlines.length) {
oldblocks[y] = new Array();
var x = 1;
while (x < 11) {
oldblocks[y][x] = eval ((("r" + deadlines[y]) + "c") + x)._currentframe;
x++;
}
y++;
}
flashed = 0;
if (deadlines.length < 4) {
sfx.attachSound("line");
} else {
sfx.attachSound("tetris");
}
sfx.start();
}
flashed++;
if (flashed < 40) {
var y = 0;
while (y < deadlines.length) {
var x = 1;
while (x < 11) {
if ((flashed % 16) < 8) {
eval ((("r" + deadlines[y]) + "c") + x).gotoAndStop(11);
} else {
eval ((("r" + deadlines[y]) + "c") + x).gotoAndStop(oldblocks[y][x]);
}
x++;
}
y++;
}
} else if (flashed == 40) {
var y = 0;
while (y < deadlines.length) {
var x = 1;
while (x < 11) {
eval ((("r" + deadlines[y]) + "c") + x).gotoAndStop(1);
x++;
}
y++;
}
} else if (flashed == 44) {
if (deadlines.length == 1) {
_root.score = _root.score + ((_root.level + 1) * 40);
} else if (deadlines.length == 2) {
_root.score = _root.score + ((_root.level + 1) * 100);
} else if (deadlines.length == 3) {
_root.score = _root.score + ((_root.level + 1) * 300);
} else if (deadlines.length == 4) {
_root.score = _root.score + ((_root.level + 1) * 1200);
}
RemoveRows();
oldblocks = false;
deadlines = false;
NewShape();
dropkey = false;
dropkeytimer = 0;
dropkeyrelease = false;
dropscore = 0;
}
}
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 1)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 2)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 3)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 4)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 5)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.score.toString();
gotoAndStop(parseInt(s.charAt(s.length - 6)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.lines.toString();
gotoAndStop(parseInt(s.charAt(s.length - 1)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.lines.toString();
gotoAndStop(parseInt(s.charAt(s.length - 2)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.lines.toString();
gotoAndStop(parseInt(s.charAt(s.length - 3)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.lines.toString();
gotoAndStop(parseInt(s.charAt(s.length - 4)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.level.toString();
gotoAndStop(parseInt(s.charAt(s.length - 1)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.level.toString();
gotoAndStop(parseInt(s.charAt(s.length - 2)) + 2);
}
Instance of Symbol 45 MovieClip in Frame 2
onClipEvent (enterFrame) {
s = _root.level.toString();
gotoAndStop(parseInt(s.charAt(s.length - 3)) + 2);
}
Symbol 25 MovieClip [block] Frame 1
stop();
Symbol 25 MovieClip [block] Frame 2
stop();
Symbol 25 MovieClip [block] Frame 3
stop();
Symbol 25 MovieClip [block] Frame 4
stop();
Symbol 25 MovieClip [block] Frame 5
stop();
Symbol 25 MovieClip [block] Frame 6
stop();
Symbol 25 MovieClip [block] Frame 7
stop();
Symbol 25 MovieClip [block] Frame 8
stop();
Symbol 25 MovieClip [block] Frame 9
stop();
Symbol 25 MovieClip [block] Frame 10
stop();
Symbol 25 MovieClip [block] Frame 11
stop();
Instance of Symbol 27 MovieClip in Symbol 28 MovieClip Frame 1
onClipEvent (load) {
_y = -144;
}
onClipEvent (enterFrame) {
if (_y < 0) {
_y = (_y+1);
}
if ((_y == 0) && (!beeped)) {
beeped = true;
beep = new Sound();
beep.attachSound("load");
beep.start();
timer = 100;
}
if (timer > 0) {
timer--;
if (((_root._framesloaded == _root._totalframes) && (beeped)) && (timer == 0)) {
_root.gotoAndPlay(2);
}
}
}
Symbol 45 MovieClip Frame 1
stop();
Symbol 45 MovieClip Frame 2
stop();
Symbol 45 MovieClip Frame 3
stop();
Symbol 45 MovieClip Frame 4
stop();
Symbol 45 MovieClip Frame 5
stop();
Symbol 45 MovieClip Frame 6
stop();
Symbol 45 MovieClip Frame 7
stop();
Symbol 45 MovieClip Frame 8
stop();
Symbol 45 MovieClip Frame 9
stop();
Symbol 45 MovieClip Frame 10
stop();
Symbol 45 MovieClip Frame 11
stop();