Frame 1
tellTarget ("_level0") {
lbLoadingGame = "";
};
Frame 2
if (_framesloaded >= _totalframes) {
gotoAndPlay (3);
} else {
gotoAndPlay (1);
}
Frame 3
Level = 0;
MaxLevel = 5;
ChangeLevel = 10;
Level0 = [];
Color0 = [];
Name0 = "Empty glass";
Level1 = [195, 185, 171, 172, 173, 174, 175, 176, 177, 178, 179, 162, 163, 164, 165, 166, 167, 168, 153, 154, 155, 156, 157, 143, 144, 145, 146, 147, 134, 135, 136, 124, 125, 126, 115];
Color1 = [5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3];
Name1 = "Christmas Tree";
Level2 = [192, 193, 194, 195, 196, 197, 181, 188, 170, 173, 174, 175, 176, 179, 160, 162, 167, 169, 150, 159, 140, 143, 146, 149, 131, 138, 122, 123, 124, 125, 126, 127];
Color2 = [4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 1, 1, 4, 4, 4, 4, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4];
Name2 = "Pretty Face";
Level3 = [194, 196, 184, 186, 173, 174, 175, 176, 177, 163, 164, 165, 166, 167, 153, 158, 141, 142, 143, 144, 145, 131, 133, 135, 121, 122, 123, 124, 125, 112, 114, 132, 134];
Color3 = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6];
Name3 = "Robo-cat";
Level4 = [190, 191, 192, 193, 194, 195, 196, 197, 198, 181, 189, 184, 185, 186, 173, 174, 175, 176, 162, 167, 165, 155, 145, 135, 125, 115, 105, 154, 143, 132, 123, 114, 133];
Color4 = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6];
Name4 = "Yacht";
Level5 = [191, 192, 193, 194, 195, 196, 180, 181, 182, 183, 184, 185, 186, 187, 170, 171, 173, 174, 175, 176, 177, 160, 161, 164, 165, 166, 167, 168, 150, 151, 155, 156, 157, 158, 159, 141, 145, 146, 147, 148, 149, 131, 132, 136, 137, 138, 139, 122, 123, 129, 113, 114, 101, 104, 90, 91, 94, 95, 80, 81, 85, 71, 75, 61, 62, 64, 65, 52, 53];
Color5 = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6];
Name5 = "Swan";
function ClearGlass() {
TotalBlocks = 1;
if (isGrid) {
ShowGrid();
}
var k = 0;
while (k < NumCells) {
Glass[k] = 0;
eval (GlassNames[k]).gotoAndPlay(6);
k++;
}
var k = 0;
while (k < NumBlocks) {
eval (FigureNames[k]).gotoAndPlay(6);
eval (PrevNames[k]).gotoAndPlay(6);
k++;
}
if (isLevels) {
var LevelI = eval ("Level" + Level);
var ColorI = eval ("Color" + Level);
var i = 0;
while (i < LevelI.length) {
TotalBlocks++;
var NewBlockName = ((("StartBlock" + ColorI[i]) + "_") + TotalBlocks);
var Block = eval ("Block" + ColorI[i]);
Block.duplicateMovieClip(NewBlockName, TotalBlocks);
NewBlock = eval (NewBlockName);
Glass[LevelI[i]] = 1;
GlassNames[LevelI[i]] = NewBlockName;
var r = Math.floor(LevelI[i] / GlassW);
var c = (LevelI[i] - (r * GlassW));
NewBlock._x = Left + (c * CellWidth);
NewBlock._y = Top + (r * CellHeight);
i++;
}
}
nLines = "0";
lbLevel = TotalLevel;
GameOver = (Wait = (Drop = (Pause = false)));
cbPause._visible = false;
SoundMove.stop();
SoundClear.stop();
NextFigure = random(NumKind) + 1;
}
function NewFigure() {
if (GameOver) {
return(undefined);
}
CurrFigure = NextFigure;
var color = Colors[CurrFigure - 1];
var CurFigX = eval (("Fig" + CurrFigure) + "X");
var CurFigY = eval (("Fig" + CurrFigure) + "Y");
X0 = int(GlassW / 2);
Y0 = 0;
var i = 0;
while (i < NumBlocks) {
X[i] = CurFigX[i];
Y[i] = CurFigY[i];
var k = ((X0 + X[i]) + ((Y0 + Y[i]) * GlassW));
if (((k >= 0) and (k < NumCells)) and (0 < Glass[k])) {
ShowGameOverWnd();
Wait = false;
return(undefined);
}
i++;
}
var i = 0;
while (i < NumBlocks) {
TotalBlocks++;
var NewBlockName = ((("Block" + color) + "_") + TotalBlocks);
eval ("Block" + color).duplicateMovieClip(NewBlockName, TotalBlocks);
NewBlock = eval (NewBlockName);
if ((Y0 + Y[i]) < 0) {
NewBlock._alpha = 0;
} else {
NewBlock._alpha = 100;
}
NewBlock._x = Left + ((X0 + X[i]) * CellWidth);
NewBlock._y = Top + ((Y0 + Y[i]) * CellHeight);
FigureNames[i] = NewBlockName;
i++;
}
var i = 0;
while (i < NumCells) {
if (0 < Glass[i]) {
var Block = eval (GlassNames[i]);
if (Block) {
var r = Math.floor(i / GlassW);
var c = (i - (r * GlassW));
Block._x = Left + (c * CellWidth);
Block._y = Top + (r * CellHeight);
}
}
i++;
}
LastTime = getTimer();
WasNewFigure = true;
LastTime = getTimer();
Drop = false;
}
function NextNewFigure() {
if (GameOver) {
return(undefined);
}
var Kind = (random(NumKind) + 1);
if (Kind == NextFigure) {
Kind = 3;
}
NextFigure = Kind;
var color = Colors[Kind - 1];
var i = 0;
while (i < NumBlocks) {
var Block = eval (PrevNames[i]);
Block.gotoAndPlay(6);
if (isPreview) {
TotalBlocks++;
var NewBlockName = ((("Prev" + color) + "_") + TotalBlocks);
eval ("Block" + color).duplicateMovieClip(NewBlockName, TotalBlocks);
NewBlock = eval (NewBlockName);
var CurFigX = eval (("Fig" + Kind) + "X");
var CurFigY = eval (("Fig" + Kind) + "Y");
NewBlock._x = Left + (((GlassW + 4) + CurFigX[i]) * CellWidth);
NewBlock._y = (Top + ((2 + CurFigY[i]) * CellHeight)) - 15;
PrevNames[i] = NewBlockName;
}
i++;
}
Drop = false;
}
function ShiftX(d) {
if (Wait) {
return(undefined);
}
Wait = true;
var i = 0;
while (i < NumBlocks) {
var k = (((X0 + X[i]) + d) + ((Y0 + Y[i]) * GlassW));
if ((((((X0 + X[i]) + d) >= GlassW) or (((X0 + X[i]) + d) < 0)) or ((Y0 + Y[i]) >= GlassH)) or (0 < Glass[k])) {
Wait = false;
return(undefined);
}
i++;
}
X0 = X0 + d;
Show();
Wait = false;
}
function ShiftY(d) {
if (Wait) {
return(undefined);
}
Wait = true;
var i = 0;
while (i < NumBlocks) {
var k = ((X0 + X[i]) + (((Y0 + Y[i]) + d) * GlassW));
if ((((Y0 + Y[i]) + d) >= GlassH) or (0 < Glass[k])) {
var j = 0;
while (j < NumBlocks) {
Glass[(X0 + X[j]) + ((Y0 + Y[j]) * GlassW)] = 1;
GlassNames[(X0 + X[j]) + ((Y0 + Y[j]) * GlassW)] = FigureNames[j];
j++;
}
ClearLines();
return(0);
}
i++;
}
Y0 = Y0 + d;
Show();
Wait = false;
return(d);
}
function Rotate(d) {
if (CurrFigure == 1) {
return(undefined);
}
if (Wait) {
return(undefined);
}
Wait = true;
var NewX = new Array(NumBlocks);
var NewY = new Array(NumBlocks);
var xs = 0;
var s = 0;
while (s < 7) {
xs = X0 + Shift[s];
var i = 0;
i = 0;
while (i < NumBlocks) {
var xi = X[i];
var yi = Y[i];
var angle = 0;
while (angle < d) {
var Xtmp = yi;
var Ytmp = (-xi);
xi = Xtmp;
yi = Ytmp;
angle++;
}
if (((((xs + xi) >= GlassW) or ((xs + xi) < 0)) or ((Y0 + yi) >= GlassH)) or (0 < Glass[(xs + xi) + ((Y0 + yi) * GlassW)])) {
if (s == 6) {
Wait = false;
return(undefined);
}
break;
}
NewX[i] = xi;
NewY[i] = yi;
i++;
}
if (i == NumBlocks) {
break;
}
s++;
}
X0 = xs;
var i = 0;
while (i < NumBlocks) {
X[i] = NewX[i];
Y[i] = NewY[i];
i++;
}
Show();
Wait = false;
}
function Show() {
var i = 0;
while (i < NumBlocks) {
var Block = eval (FigureNames[i]);
if ((Y0 + Y[i]) < 0) {
Block._alpha = 0;
} else {
Block._alpha = 100;
}
Block._x = Left + ((X0 + X[i]) * CellWidth);
Block._y = Top + ((Y0 + Y[i]) * CellHeight);
i++;
}
}
function ClearLines() {
StartShift = -1;
var i;
var j;
var nClear = 0;
j = GlassH - 1;
while (j >= 0) {
i = 0;
while (i < GlassW) {
if (Glass[i + (j * GlassW)] == 0) {
break;
}
i++;
}
if (i < GlassW) {
} else {
i = 0;
while (i < GlassW) {
Glass[i + (j * GlassW)] = 0;
var Block = eval (GlassNames[i + (j * GlassW)]);
GlassNames[i + (j * GlassW)] = "";
Block.gotoAndPlay(2);
i++;
}
if (StartShift < 0) {
StartShift = j;
}
nClear++;
}
j--;
}
if (0 < nClear) {
Score = (Number(Score) + (2 * nClear)) - 1;
nLines = Number(nLines) + nClear;
StartClear = true;
FinishClear = false;
if (isSound) {
SoundClear.start();
}
TimeDelay = StartTimeDelay / (1 + (0.05 * Number(nLines)));
if (TimeDelay < 75) {
TimeDelay = 75;
}
} else {
Wait = false;
NewFigure();
NextNewFigure();
}
}
function Compress() {
if (!isShift) {
NewFigure();
NextNewFigure();
Wait = false;
return(undefined);
}
Wait = true;
var i;
var j;
var FinishShift = 0;
j = 0;
while (j < GlassH) {
i = 0;
while (i < GlassW) {
if (0 < Glass[i + (j * GlassW)]) {
break;
}
i++;
}
if (i < GlassW) {
FinishShift = j;
break;
}
j++;
}
j = StartShift;
while (j >= FinishShift) {
i = 0;
while (i < GlassW) {
if (0 < Glass[i + (j * GlassW)]) {
break;
}
i++;
}
if (i < GlassW) {
} else {
var j1 = j;
while (j1 >= FinishShift) {
i = 0;
while (i < GlassW) {
if (0 < j1) {
Glass[i + (j1 * GlassW)] = Glass[i + ((j1 - 1) * GlassW)];
GlassNames[i + (j1 * GlassW)] = GlassNames[i + ((j1 - 1) * GlassW)];
var Block = eval (GlassNames[i + (j1 * GlassW)]);
if (Block) {
Block._x = Left + (i * CellWidth);
Block._y = Top + (j1 * CellHeight);
}
} else {
Glass[i + (j1 * GlassW)] = 0;
GlassNames[i + (j1 * GlassW)] = "";
}
i++;
}
j1--;
}
FinishShift++;
j++;
}
j--;
}
if (isLevels and (Number(nLines) >= ChangeLevel)) {
Level++;
TotalLevel++;
if (MaxLevel < Level) {
Level = 0;
StartTimeDelay = StartTimeDelay * 0.7;
if (StartTimeDelay < 75) {
StartTimeDelay = 75;
}
}
ClearGlass();
NewFigure();
ShowLevelWnd();
Wait = true;
ShowLevel = true;
return(undefined);
}
NewFigure();
NextNewFigure();
Wait = false;
}
function ShowGrid() {
var i = 1;
while (i < GlassW) {
TotalBlocks++;
LineVertical.duplicateMovieClip("LineVertical" + i, TotalBlocks);
var Line = eval ("LineVertical" + i);
Line._x = Left + ((i - 0.47) * CellWidth);
Line._y = (Top + (Line._height / 2)) - 10;
i++;
}
var j = 1;
while (j < GlassH) {
TotalBlocks++;
LineHorisontal.duplicateMovieClip("LineHorisontal" + j, TotalBlocks);
var Line = eval ("LineHorisontal" + j);
Line._x = (Left + ((CellWidth * (GlassW - 0.5)) / 2)) - 5;
Line._y = Top + ((j - 0.53) * CellHeight);
j++;
}
}
function HideGrid() {
var i = 1;
while (i < GlassW) {
removeMovieClip("LineVertical" + i);
i++;
}
var j = 1;
while (j < GlassH) {
removeMovieClip("LineHorisontal" + j);
j++;
}
}
function ShowPauseWnd() {
attachMovie("WndMessage", "WndMessagePause", 1000000);
WndMessagePause._x = Left;
WndMessagePause._y = Top + (CellHeight * 6);
WndMessagePause.lb1 = "Pause";
WndMessagePause.lb2 = "Click End to continue";
WndMessagePause.lb3 = "";
}
function HidePauseWnd() {
removeMovieClip("WndMessagePause");
}
function ShowGameOverWnd() {
attachMovie("WndMessage", "WndMessageGameOver", 1000000);
WndMessageGameOver._x = Left;
WndMessageGameOver._y = Top + (CellHeight * 6);
WndMessageGameOver.lb1 = "Game over";
WndMessageGameOver.lb2 = "Click \"Restart\"";
WndMessageGameOver.lb3 = "";
GameOver = true;
}
function HideGameOverWnd() {
removeMovieClip("WndMessageGameOver");
}
function ShowLevelWnd() {
attachMovie("WndMessage", "WndMessageLevel", 1000000);
WndMessageLevel._x = Left;
WndMessageLevel._y = Top + (CellHeight * 1);
WndMessageLevel.lb2 = eval ("Name" + Level);
WndMessageLevel.lb1 = "Level " + TotalLevel;
WndMessageLevel.lb3 = "press any key to continue";
}
function HideLevelWnd() {
removeMovieClip("WndMessageLevel");
}
function ShowTraceGlass() {
var j = 0;
while (j < GlassH) {
var st = "";
var i = 0;
while (i < GlassW) {
st = st + Glass[i + (j * GlassW)];
i++;
}
trace(st);
j++;
}
trace("==============================");
}
if (!initialized) {
initialized = true;
} else {
return(undefined);
}
fscommand ("allowscale", true);
fscommand ("showmenu", false);
GlassW = 10;
GlassH = 20;
NumCells = GlassW * GlassH;
NumBlocks = 4;
X = new Array(NumBlocks);
Y = new Array(NumBlocks);
CellWidth = Block1._width + 2;
CellHeight = Block1._height + 2;
Left = ((GlassClip._x - (GlassClip._width / 2)) + CellWidth) + 6;
Top = ((GlassClip._y - (GlassClip._height / 2)) + (4 * CellHeight)) - 4;
NumKind = 7;
Fig1X = [0, 1, 1, 0];
Fig1Y = [0, 0, 1, 1];
Fig2X = [0, -1, 1, 0];
Fig2Y = [0, 0, 0, 1];
Fig3X = [0, -1, 1, 2];
Fig3Y = [0, 0, 0, 0];
Fig4X = [0, -1, 1, 1];
Fig4Y = [0, 0, 0, 1];
Fig5X = [0, -1, 1, -1];
Fig5Y = [0, 0, 0, 1];
Fig6X = [0, 0, -1, 1];
Fig6Y = [0, 1, 1, 0];
Fig7X = [0, -1, 0, 1];
Fig7Y = [0, 0, 1, 1];
Shift = [0, 1, -1, 2, -2, 3, -3];
Colors = [1, 2, 3, 4, 5, 6, 7];
Glass = new Array(NumCells);
X = new Array(NumBlocks);
Y = new Array(NumBlocks);
GlassNames = new Array(NumCells);
FigureNames = new Array(NumBlocks);
PrevNames = new Array(NumBlocks);
LastTime = getTimer();
StartTime = int(getTimer() / 1000);
GameOver = false;
Drop = false;
Pause = false;
StartClear = false;
FinishClear = false;
Wait = false;
TimeDelay = 1000;
StartTimeDelay = 1000;
TotalLevel = 0;
ShowLevel = false;
isPreview = true;
isSound = true;
isShift = true;
isAccelerate = true;
isLevels = true;
isGrid = true;
SoundMove = new Sound();
SoundMove.attachSound("WavMove");
SoundClear = new Sound();
SoundClear.attachSound("WavClear");
ClearGlass();
NewFigure();
NextNewFigure();
cbPause._visible = false;
Instance of Symbol 37 MovieClip in Frame 3
onClipEvent (mouseDown) {
if (hitTest(_root._xmouse, _root._ymouse, false)) {
_root.ShowTraceGlass();
}
}
Instance of Symbol 97 MovieClip "GlassClip" in Frame 3
onClipEvent (keyDown) {
if (_root.ShowLevel) {
_root.Wait = (_root.ShowLevel = false);
_root.HideLevelWnd();
return(undefined);
}
if (Key.isDown(Key.ENTER) and _root.HelpShow) {
removeMovieClip("_root.WndList");
_root.HelpShow = (_root.Pause = false);
_root.cbPause._visible = false;
}
if ((Key.isDown(Key.END) or Key.isDown(80)) and (!(_root.GameOver or _root.Wait))) {
_root.Pause = !_root.Pause;
if (_root.Pause) {
_root.ShowPauseWnd();
_root.cbPause._visible = true;
} else {
_root.HidePauseWnd();
_root.cbPause._visible = false;
}
}
if ((_root.Pause or _root.GameOver) or _root.Wait) {
return(undefined);
}
if (Key.isDown(Key.LEFT)) {
_root.ShiftX(-1);
if (_root.isSound) {
_root.SoundMove.start();
}
}
if (Key.isDown(Key.RIGHT)) {
_root.ShiftX(1);
if (_root.isSound) {
_root.SoundMove.start();
}
}
if (Key.isDown(Key.DOWN)) {
_root.ShiftY(1);
}
if (Key.isDown(Key.UP)) {
_root.Rotate(1);
if (_root.isSound) {
_root.SoundMove.start();
}
}
if (Key.isDown(Key.SPACE) and (!_root.WasNewFigure)) {
_root.Drop = true;
}
}
Frame 5
if (WasNewFigure and (300 < (getTimer() - LastTime))) {
WasNewFigure = false;
}
if ((TimeDelay < (getTimer() - LastTime)) and (!(((GameOver or Pause) or Wait) or Drop))) {
ShiftY(1);
WasNewFigure = false;
LastTime = getTimer();
}
if (Drop and (!((Pause or Wait) or WasNewFigure))) {
if (ShiftY(1) == 0) {
Drop = false;
}
}
if ((StartClear and FinishClear) and (!GameOver)) {
Compress();
StartClear = false;
}
prevFrame();
play();
Symbol 21 Button [btPause]
on (release) {
if (_root.ShowLevel) {
return(undefined);
}
if (_root.HelpShow) {
return(undefined);
}
if (_root.GameOver) {
return(undefined);
}
_root.Pause = !_root.Pause;
if (_root.Pause) {
_root.ShowPauseWnd();
_root.cbPause._visible = true;
} else {
_root.HidePauseWnd();
_root.cbPause._visible = false;
}
}
Symbol 22 Button [btShowNext]
on (release) {
_root.isPreview = !_root.isPreview;
if (_root.isPreview) {
_root.NextNewFigure();
_root.Checker1._visible = true;
} else {
var i = 0;
while (i < _root.NumBlocks) {
var Block = eval (_root.PrevNames[i]);
Block.gotoAndPlay(6);
i++;
}
_root.Checker1._visible = false;
}
}
Symbol 32 Button
on (release) {
getURL ("http://absolutist.com/games.html", "_blank");
}
Symbol 40 Button
on (release) {
_root.isGrid = !_root.isGrid;
if (_root.isGrid) {
ShowGrid();
_root.Checker7._visible = true;
} else {
HideGrid();
_root.Checker7._visible = false;
}
}
Symbol 54 Button
on (release) {
_root.isLevels = !_root.isLevels;
if (_root.isLevels) {
_root.Checker5._visible = true;
} else {
_root.Checker5._visible = false;
}
}
Symbol 57 Button
on (release) {
_root.isAccelerate = !_root.isAccelerate;
if (_root.isAccelerate) {
_root.Checker4._visible = true;
} else {
_root.Checker4._visible = false;
}
}
Symbol 59 Button
on (release) {
_root.isShift = !_root.isShift;
if (_root.isShift) {
_root.Checker3._visible = true;
} else {
_root.Checker3._visible = false;
}
}
Symbol 61 Button
on (release) {
_root.isSound = !_root.isSound;
if (_root.isSound) {
_root.Checker2._visible = true;
} else {
_root.Checker2._visible = false;
}
}
Symbol 70 Button
on (release) {
getURL ("http://absolutist.com", "_blank");
}
Symbol 74 Button
on (release) {
Level = 0;
ClearGlass();
NewFigure();
NextNewFigure();
Score = "0";
nLines = "0";
lbLevel = "0";
TimeDelay = 1000;
StartTimeDelay = 1000;
TotalLevel = 0;
HideGameOverWnd();
ClickHere = "Click here if keys don't work";
GameOver = false;
StartTime = int(getTimer() / 1000);
HidePauseWnd();
HideGameOverWnd();
HideLevelWnd();
}
Symbol 77 MovieClip Frame 1
stop();
Symbol 77 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 80 MovieClip Frame 1
stop();
Symbol 80 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 83 MovieClip Frame 1
stop();
Symbol 83 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 86 MovieClip Frame 1
stop();
Symbol 86 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 89 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 92 MovieClip Frame 1
stop();
Symbol 92 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 95 MovieClip Frame 1
stop();
Symbol 95 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");