Frame 1
tellTarget ("_level0") {
lbLoadingGame = "";
};
Frame 2
if (_framesloaded >= _totalframes) {
gotoAndPlay (3);
} else {
gotoAndPlay (1);
}
Frame 3
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 < 5) {
eval (FigureNames[k]).gotoAndPlay(6);
eval (PrevNames[k]).gotoAndPlay(6);
k++;
}
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;
if (CurrFigure < 8) {
NumBlocks = 4;
} else {
NumBlocks = 5;
}
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 < 5) {
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 = 5;
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 = 25;
Fig1X = [0, 1, 1, 0, 0];
Fig1Y = [0, 0, 1, 1, 1];
Fig2X = [0, -1, 1, 0, 0];
Fig2Y = [0, 0, 0, 1, 1];
Fig3X = [0, -1, 1, 2, 2];
Fig3Y = [0, 0, 0, 0, 0];
Fig4X = [0, -1, 1, 1, 1];
Fig4Y = [0, 0, 0, 1, 1];
Fig5X = [0, -1, 1, 1, 1];
Fig5Y = [0, 0, 0, -1, -1];
Fig6X = [0, 0, 1, 1, 1];
Fig6Y = [0, -1, 0, 1, 1];
Fig7X = [0, 0, 1, 1, 1];
Fig7Y = [0, 1, 0, -1, -1];
Fig8X = [0, 1, 0, -1, 0];
Fig8Y = [0, 0, 1, 0, -1];
Fig9X = [0, 1, 1, -1, -1];
Fig9Y = [0, 0, -1, -1, 0];
Fig10X = [0, 1, 1, -1, -1];
Fig10Y = [0, 0, 1, 0, -1];
Fig11X = [0, 1, 1, -1, -1];
Fig11Y = [0, 0, -1, 0, 1];
Fig12X = [0, 1, 0, -1, -2];
Fig12Y = [0, 0, -1, 0, 0];
Fig13X = [0, 1, 0, -1, -2];
Fig13Y = [0, 0, 1, 0, 0];
Fig14X = [0, 1, 1, 0, 1];
Fig14Y = [0, 0, 1, 1, -1];
Fig15X = [0, 0, -1, -1, -1];
Fig15Y = [0, 1, 1, 0, -1];
Fig16X = [0, 1, 2, -1, -2];
Fig16Y = [0, 0, 0, 0, 0];
Fig17X = [0, 1, 1, -1, -2];
Fig17Y = [0, 0, -1, 0, 0];
Fig18X = [0, 1, 1, -1, -2];
Fig18Y = [0, 0, 1, 0, 0];
Fig19X = [0, 1, 0, -1, -1];
Fig19Y = [0, 0, -1, 0, 1];
Fig20X = [0, 1, -1, -1, 0];
Fig20Y = [0, 0, -1, 0, 1];
Fig21X = [0, 1, 0, -1, -1];
Fig21Y = [0, 1, 1, 0, -1];
Fig22X = [0, 0, 0, 1, -1];
Fig22Y = [0, 1, -1, -1, -1];
Fig23X = [-1, 0, 1, 1, 1];
Fig23Y = [-1, -1, -1, 0, 1];
Fig24X = [0, 0, 1, -1, -2];
Fig24Y = [0, -1, -1, 0, 0];
Fig25X = [-2, -1, 0, 0, 1];
Fig25Y = [-1, -1, -1, 0, 0];
Shift = [0, 1, -1, 2, -2, 3, -3];
Colors = [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4];
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 = false;
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 89 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 51 Button
on (release) {
_root.isAccelerate = !_root.isAccelerate;
if (_root.isAccelerate) {
_root.Checker4._visible = true;
} else {
_root.Checker4._visible = false;
}
}
Symbol 53 Button
on (release) {
_root.isSound = !_root.isSound;
if (_root.isSound) {
_root.Checker2._visible = true;
} else {
_root.Checker2._visible = false;
}
}
Symbol 62 Button
on (release) {
getURL ("http://absolutist.com", "_blank");
}
Symbol 66 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 69 MovieClip Frame 1
stop();
Symbol 69 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 72 MovieClip Frame 1
stop();
Symbol 72 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 75 MovieClip Frame 1
stop();
Symbol 75 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 78 MovieClip Frame 1
stop();
Symbol 78 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 81 MovieClip Frame 1
stop();
Symbol 81 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");
Symbol 87 MovieClip Frame 1
stop();
Symbol 87 MovieClip Frame 6
_root.FinishClear = true;
removeMovieClip("");