Frame 1
if (intro != 0) {
go_url = 0;
thesound = 1;
debut = 0;
musik = new Sound();
musik.attachSound("musik");
musik.start(0);
error = new Sound();
error.attachSound("error");
soundsetcard = new Sound();
soundsetcard.attachSound("soundsetcard");
soundtimesup = new Sound();
soundtimesup.attachSound("soundtimesup");
selecte = new Sound();
selecte.attachSound("selecte");
}
intro = 0;
barre._width = barre._width + 1;
Instance of Symbol 26 MovieClip in Frame 1
/* no clip actions */
Frame 2
if (barre._width < 315) {
gotoAndPlay (1);
} else {
gotoAndPlay (3);
}
Frame 3
if (new_game != 1) {
display.highscore = 0;
}
new_game = 1;
godown = 0;
cpt_space = 0;
restart._y = 500;
display.score = 0;
display.level = 1;
vitesse = 1000;
range_x = 10;
range_y = 20;
ltotal = 0;
blocks = [[[[0, 1, 0], [1, 1, 1], [0, 0, 0]], [[0, 1, 0], [0, 1, 1], [0, 1, 0]], [[0, 0, 0], [1, 1, 1], [0, 1, 0]], [[0, 1, 0], [1, 1, 0], [0, 1, 0]]], [[[0, 1, 0], [0, 1, 0], [1, 1, 0]], [[1, 0, 0], [1, 1, 1], [0, 0, 0]], [[0, 1, 1], [0, 1, 0], [0, 1, 0]], [[0, 0, 0], [1, 1, 1], [0, 0, 1]]], [[[0, 1, 0], [0, 1, 0], [0, 1, 1]], [[0, 0, 0], [1, 1, 1], [1, 0, 0]], [[1, 1, 0], [0, 1, 0], [0, 1, 0]], [[0, 0, 1], [1, 1, 1], [0, 0, 0]]], [[[0, 0, 0], [0, 1, 1], [1, 1, 0]], [[1, 0, 0], [1, 1, 0], [0, 1, 0]], [[0, 1, 1], [1, 1, 0], [0, 0, 0]], [[0, 1, 0], [0, 1, 1], [0, 0, 1]]], [[[0, 0, 0], [1, 1, 0], [0, 1, 1]], [[0, 1, 0], [1, 1, 0], [1, 0, 0]], [[1, 1, 0], [0, 1, 1], [0, 0, 0]], [[0, 0, 1], [0, 1, 1], [0, 1, 0]]], [[[1, 1], [1, 1]], [[1, 1], [1, 1]], [[1, 1], [1, 1]], [[1, 1], [1, 1]]], [[[0, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0]], [[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]]];
goMC = this.createEmptyMovieClip("goMC_", 100);
goMC.s = new Sound(goMC);
goMC.s.attachSound("soundsetcard");
rotateMC = this.createEmptyMovieClip("rotateMC_", 101);
rotateMC.s = new Sound(rotateMC);
rotateMC.s.attachSound("rotate");
fullMC = this.createEmptyMovieClip("fullMC_", 102);
fullMC.s = new Sound(fullMC);
fullMC.s.attachSound("full");
Screen = function (tetris) {
this.tetris = tetris;
this.colors = [{top:14124465, front:11024244, right:3281187, left:5840189}, {top:11634135, front:7616424, right:2298162, left:4005209}, {top:14440804, front:10691374, right:3148558, left:5640985}, {top:9207236, front:5259405, right:1577769, left:2761290}, {top:8771505, front:3647604, right:1126947, left:1923389}, {top:14274241, front:10651493, right:4403504, left:5654324}, {top:14135685, front:11039799, right:3285777, left:5848349}];
this.tetris.colors = this.colors;
this.fieldsize = 20;
this.gridcolor = 6776679 /* 0x676767 */;
this.loc = _root.scene;
this.init();
this.update();
};
Screen.prototype.to3d = function (field) {
var eyeAngle = 250;
var CamDist = 300;
var i = 0;
while (i < 8) {
var pers = (eyeAngle / (field[i][2] + camDist));
field[i][0] = field[i][0] * pers;
field[i][1] = field[i][1] * pers;
i++;
}
return(field);
};
Screen.prototype.init = function () {
createEmptyMovieClip("gr", 1);
var num = 0;
var x;
var y;
this.grid = [];
var k = 0;
while (k < this.tetris.rows) {
this.grid[k] = [];
var i = (this.tetris.cols - 1);
gr.lineStyle(1, 16777215, 50);
while (i > -1) {
var field = [];
x = (50 + (i * this.fieldsize)) - (((this.tetris.cols - 1) / 2) * this.fieldsize);
y = (k * this.fieldsize) - (((this.tetris.rows - 1) / 2) * this.fieldsize);
field[0] = [x - (this.fieldsize / 2), 0, y - (this.fieldsize / 2)].rotate();
field[1] = [x + (this.fieldsize / 2), 0, y - (this.fieldsize / 2)].rotate();
field[2] = [x + (this.fieldsize / 2), 0, y + (this.fieldsize / 2)].rotate();
field[3] = [x - (this.fieldsize / 2), 0, y + (this.fieldsize / 2)].rotate();
field[4] = [x - (this.fieldsize / 2), -this.fieldsize, y - (this.fieldsize / 2)].rotate();
field[5] = [x + (this.fieldsize / 2), -this.fieldsize, y - (this.fieldsize / 2)].rotate();
field[6] = [x + (this.fieldsize / 2), -this.fieldsize, y + (this.fieldsize / 2)].rotate();
field[7] = [x - (this.fieldsize / 2), -this.fieldsize, y + (this.fieldsize / 2)].rotate();
field = this.to3d(field);
gr.moveTo(140 + field[0][0], 100 + field[0][1]);
gr.lineto(140 + field[1][0], 100 + field[1][1]);
gr.lineto(140 + field[2][0], 100 + field[2][1]);
gr.lineto(140 + field[3][0], 100 + field[3][1]);
this.grid[k][i] = field;
i--;
}
gr.lineto(140 + field[0][0], 100 + field[0][1]);
k++;
}
};
Array.prototype.rotate = function () {
var xa = -150;
var ya = 0;
var rad = 0.017;
var cosYangle = Math.cos(ya * rad);
var sinYangle = Math.sin(ya * rad);
var cosXangle = Math.cos(xa * rad);
var sinXangle = Math.sin(xa * rad);
var tempz = ((this[2] * cosYangle) - (this[0] * sinYangle));
var tmpx = ((this[2] * sinYangle) + (this[0] * cosYangle));
var tmpz = (((-this[1]) * sinXangle) + (tempz * cosXangle));
var tmpy = (((-this[1]) * cosXangle) - (tempz * sinXangle));
this[0] = tmpx;
this[1] = tmpy;
this[2] = tmpz;
return(this);
};
Screen.prototype.update = function (occupied) {
var loc = this.loc;
loc.clear();
loc.swapDepths(100);
var field;
var p0x;
var p0y;
var p1x;
var p1y;
var p2x;
var p2y;
var p3x;
var p3y;
var p4x;
var p4y;
var p5x;
var p5y;
var p6x;
var p6y;
var p7x;
var p7y;
var tetris = this.tetris;
var k = 0;
while (k < tetris.currentBlock[tetris.currentRotate].length) {
var i = 0;
while (i < tetris.currentBlock[tetris.currentRotate][0].length) {
if (tetris.currentBlock[tetris.currentRotate][k][i] == 1) {
tetris.map[k + tetris.currentBlock.y][i + tetris.currentBlock.x] = this.colors[tetris.currentIndex];
}
i++;
}
k++;
}
var k = 0;
while (k < tetris.rows) {
var i = 0;
while (i < tetris.cols) {
field = this.grid[k][i];
if (tetris.map[k][i] != null) {
(p0x = field[0][0]);
(p0y = field[0][1]);
(p1x = field[1][0]);
(p1y = field[1][1]);
(p2x = field[2][0]);
(p2y = field[2][1]);
(p3x = field[3][0]);
(p3y = field[3][1]);
(p4x = field[4][0]);
(p4y = field[4][1]);
(p5x = field[5][0]);
(p5y = field[5][1]);
(p6x = field[6][0]);
(p6y = field[6][1]);
(p7x = field[7][0]);
(p7y = field[7][1]);
var z = (((p5x - p1x) * (p6y - p1y)) - ((p5y - p1y) * (p6x - p1x)));
if ((z < 0) && (tetris.map[k][i + 1] == null)) {
loc.beginFill(tetris.map[k][i].right, 100);
loc.moveTo(p2x, p2y);
loc.lineTo(p1x, p1y);
loc.lineTo(p5x, p5y);
loc.lineTo(p6x, p6y);
loc.lineTo(p2x, p2y);
loc.endFill();
}
if ((z > 0) && (tetris.map[k][i - 1] == null)) {
loc.beginFill(this.tetris.map[k][i].left);
loc.moveTo(p0x, p0y);
loc.lineTo(p3x, p3y);
loc.lineTo(p7x, p7y);
loc.lineTo(p4x, p4y);
loc.lineTo(p0x, p0y);
loc.endFill();
}
if (tetris.map[k + 1][i] == null) {
loc.beginFill(tetris.map[k][i].front, 100);
loc.moveTo(p3x, p3y);
loc.lineTo(p2x, p2y);
loc.lineTo(p6x, p6y);
loc.lineTo(p7x, p7y);
loc.lineTo(p3x, p3y);
loc.endFill();
}
loc.lineStyle();
loc.beginFill(tetris.map[k][i].top);
loc.moveTo(p4x, p4y);
loc.lineTo(p5x, p5y);
loc.lineTo(p6x, p6y);
loc.lineTo(p7x, p7y);
loc.lineTo(p4x, p4y);
loc.endFill();
}
i++;
}
k++;
}
updateAfterEvent();
if (occupied) {
return(undefined);
}
var k = 0;
while (k < tetris.currentBlock[tetris.currentRotate].length) {
var i = 0;
while (i < tetris.currentBlock[tetris.currentRotate][0].length) {
if (tetris.currentBlock[tetris.currentRotate][k][i] == 1) {
tetris.map[k + tetris.currentBlock.y][i + tetris.currentBlock.x] = null;
}
i++;
}
k++;
}
};
Tetris = function (rows, cols, blocks) {
this.rows = rows;
this.cols = cols;
this.blocks = blocks;
this.buildMap();
this.nextIndex = random(7);
this.nextRotate = random(4);
this.screen = new Screen(this);
updateAfterEvent();
};
Tetris.prototype.buildMap = function () {
this.map = [];
var k = 0;
while (k < this.rows) {
this.map[k] = [];
var i = 0;
while (i < this.cols) {
this.map[k][i] = null;
i++;
}
k++;
}
};
Tetris.prototype.createBlock = function () {
this.currentRotate = this.nextRotate;
this.currentIndex = this.nextIndex;
this.nextIndex = random(7);
this.nextRotate = random(4);
_root.display.stone._rotation = this.nextRotate * 90;
_root.display.stone.gotoAndStop(this.nextIndex + 1);
_root.display.shadow._rotation = this.nextRotate * 90;
_root.display.shadow.gotoAndStop(this.nextIndex + 1);
this.currentBlock = this.blocks[this.currentIndex];
Key.addListener(this.currentBlock);
this.currentBlock.x = 4;
this.currentBlock.y = 0;
this.currentBlock.obj = this;
this.currentBlock.onKeyDown = function () {
if (Key.isDown(39)) {
this.obj.checkMove({x:1, y:0});
} else if (Key.isDown(37)) {
this.obj.checkMove({x:-1, y:0});
}
if (Key.isDown(40)) {
clearInterval(this.obj.whileBlock);
this.obj.whileBlock = setInterval(this.obj, "checkMove", 10, {x:0, y:1});
}
if (Key.isDown(38)) {
this.obj.rotateBlock();
}
if (Key.isDown(32)) {
godown = 1;
if (cpt_space < 5) {
_root.display.score = _root.display.score + 1;
}
clearInterval(this.obj.whileBlock);
this.obj.whileBlock = setInterval(this.obj, "checkMove", 0, {x:0, y:1});
}
};
this.currentBlock.onKeyUp = function () {
if (Key.getCode() == 40) {
clearInterval(this.obj.whileBlock);
this.obj.whileBlock = setInterval(this.obj, "checkMove", vitesse, {x:0, y:1});
}
};
this.whileBlock = setInterval(this, "checkMove", vitesse, {x:0, y:1});
this.checkMove({x:0, y:0});
};
Tetris.prototype.checkMove = function (vec) {
var k = 0;
while (k < this.currentBlock[this.currentRotate].length) {
var i = 0;
while (i < this.currentBlock[this.currentRotate][0].length) {
var solid = (this.currentBlock[this.currentRotate][k][i] != 0);
var occupied = (this.map[(k + this.currentBlock.y) + vec.y][(i + this.currentBlock.x) + vec.x] != null);
var bottom = (((k + this.currentBlock.y) + vec.y) == this.rows);
var right = (((i + this.currentBlock.x) + vec.x) == this.cols);
var left = (((i + this.currentBlock.x) + vec.x) == -1);
if (((solid && (occupied)) && (vec.x == 0)) && (vec.y == 0)) {
clearInterval(this.whileBlock);
Key.removeListener(this.currentBlock);
if (thesound == 1) {
soundtimesup.start(0);
}
restart._y = 350;
return(undefined);
}
if (solid && (right || (left))) {
return(undefined);
}
if ((solid && (occupied)) && (vec.x != 0)) {
return(undefined);
}
if (solid && (occupied || (bottom))) {
if (thesound == 1) {
_root.goMC.s.start();
}
this.occupyMap();
return(undefined);
}
i++;
}
k++;
}
this.currentBlock.x = this.currentBlock.x + vec.x;
this.currentBlock.y = this.currentBlock.y + vec.y;
if (godown == 0) {
this.screen.update();
cpt_space++;
}
};
Tetris.prototype.rotateBlock = function () {
var copy = this.currentRotate;
this.currentRotate = this.currentRotate + ((this.currentRotate < 3) ? 1 : -3);
var k = 0;
while (k < this.currentBlock[this.currentRotate].length) {
var i = 0;
while (i < this.currentBlock[this.currentRotate][0].length) {
var solid = (this.currentBlock[this.currentRotate][k][i] != 0);
var occupied = (this.map[k + this.currentBlock.y][i + this.currentBlock.x] != null);
var bottom = ((k + this.currentBlock.y) == this.rows);
var right = ((i + this.currentBlock.x) == this.cols);
var left = ((i + this.currentBlock.x) == -1);
if (solid && (((right || (left)) || (occupied)) || (bottom))) {
this.currentRotate = copy;
return(undefined);
}
i++;
}
k++;
}
if (thesound == 1) {
rotateMC.s.start();
}
this.screen.update();
};
Tetris.prototype.occupyMap = function () {
godown = 0;
cpt_space = 0;
var k = 0;
while (k < this.currentBlock[this.currentRotate].length) {
var i = 0;
while (i < this.currentBlock[this.currentRotate][0].length) {
if (this.currentBlock[this.currentRotate][k][i] == 1) {
this.map[k + this.currentBlock.y][i + this.currentBlock.x] = this.colors[this.currentIndex];
}
i++;
}
k++;
}
clearInterval(this.whileBlock);
Key.removeListener(this.currentBlock);
this.screen.update(true);
this.checkFullLines();
this.createBlock();
};
Tetris.prototype.checkFullLines = function () {
var full;
var k = 0;
var l = 0;
while (k < this.rows) {
full = true;
var i = 0;
while (i < this.cols) {
if (this.map[k][i] == null) {
full = false;
}
i++;
}
if (full) {
l++;
if (thesound == 1) {
fullMC.s.start();
}
this.map.splice(k, 1);
var emptyLine = [];
i = 0;
while (i < this.cols) {
emptyLine[i] = null;
i++;
}
this.map.unshift(emptyLine);
}
k++;
}
if (l == 1) {
_root.display.score = _root.display.score + 5;
}
if (l == 2) {
_root.display.score = _root.display.score + 15;
}
if (l == 3) {
_root.display.score = _root.display.score + 30;
}
if (l == 4) {
_root.display.score = _root.display.score + 50;
}
if (_root.display.score > _root.display.highscore) {
_root.display.highscore = _root.display.score;
}
if (((_root.display.level == 1) and ((ltotal + l) > 9)) and ((ltotal + l) < 20)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 2) and ((ltotal + l) > 19)) and ((ltotal + l) < 30)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 3) and ((ltotal + l) > 29)) and ((ltotal + l) < 40)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 4) and ((ltotal + l) > 39)) and ((ltotal + l) < 50)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 5) and ((ltotal + l) > 49)) and ((ltotal + l) < 60)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 6) and ((ltotal + l) > 59)) and ((ltotal + l) < 70)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 7) and ((ltotal + l) > 69)) and ((ltotal + l) < 80)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 8) and ((ltotal + l) > 79)) and ((ltotal + l) < 90)) {
_root.display.level++;
vitesse = vitesse - 100;
}
if (((_root.display.level == 9) and ((ltotal + l) > 89)) and ((ltotal + l) < 100)) {
_root.display.level++;
vitesse = vitesse - 100;
}
ltotal = ltotal + l;
};
myTetris = new Tetris(range_y, range_x, blocks);
stop();
Frame 9
myTetris.createBlock();
stop();
Symbol 8 MovieClip [field] Frame 1
stop();
Symbol 11 Button
on (press) {
getURL ("http://www.flash-gamer.eu");
}
Symbol 12 Button
on (press) {
getURL ("http://www.high-scores.eu");
}
Symbol 13 Button
on (press) {
getURL ("http://www.iq-tests.eu");
}
Symbol 14 Button
on (press) {
getURL ("http://www.zodiac-games.com");
}
Symbol 15 Button
on (press) {
getURL ("http://www.intelligence-test.eu");
}
Symbol 16 Button
on (press) {
getURL ("http://www.my-iq.net");
}
Symbol 17 Button
on (press) {
getURL ("http://www.z-lyrics.eu");
}
Symbol 18 Button
on (press) {
getURL ("http://www.inachisio.com");
}
Symbol 19 Button
on (press) {
getURL ("http://www.clock4blog.eu");
}
Symbol 20 Button
on (press) {
getURL ("http://www.photo-pixel.eu");
}
Symbol 21 Button
on (press) {
getURL ("http://www.guitare-tabs.eu");
}
Symbol 22 Button
on (press) {
getURL ("http://www.test-de-qi.eu");
}
Symbol 23 Button
on (press) {
getURL ("http://www.agora-photo.com");
}
Symbol 26 MovieClip Frame 1
cpt_go_url = 0;
_root.onEnterFrame = function () {
if (_root.go_url == 1) {
cpt_go_url++;
}
if (cpt_go_url == 5) {
getURL (_root.go_url2, "_blank");
cpt_go_url = 0;
_root.go_url = 0;
}
};
Symbol 42 Button
on (release) {
getURL ("http://www.high-scores.eu");
_root.go_url = 1;
_root.go_url2 = "http://www.high-scores.eu";
}
Symbol 57 MovieClip Frame 1
stop();
Symbol 62 Button
on (release) {
code1 = ["2", "1", "D", "F", "4", "0", "A", "8", "3", "C"];
code2 = ["2", "0", "A", "E", "B", "D", "6", "9", "5", "7"];
equa1 = (_root.display.highscore + 10) * 11;
equa2 = (_root.display.highscore + 11) * 11;
score_string1 = equa1.toString();
score_string2 = equa2.toString();
while (score_string1.length < score_string2.length) {
score_string1 = "0" + score_string1;
}
i = 0;
codage = "";
while (i < score_string2.length) {
pos_string1 = Number(score_string1.charAt(i));
pos_string2 = Number(score_string2.charAt(i));
codage = (codage + code1[pos_string1]) + code2[pos_string2];
i++;
}
getURL ("http://www.high-scores.eu/new/index.php?page=10&game=2&result=" + codage);
_root.go_url = 1;
_root.go_url2 = "http://www.high-scores.eu/new/index.php?page=10&game=2&result=" + codage;
}
Symbol 65 Button
on (release) {
k = 2;
while (k < 21) {
_root.myTetris.map.splice(k, 1);
var emptyLine = [];
i = 0;
while (i < _root.range_x) {
emptyLine[i] = null;
i++;
}
_root.myTetris.map.unshift(emptyLine);
k++;
}
_root.gotoAndStop(3);
}
Symbol 68 Button
on (release, keyPress "<Enter>") {
getURL ("http://www.intelligence-test.eu/index.php?ref=" + _root.fond._url);
_root.go_url = 1;
_root.go_url2 = "http://www.intelligence-test.eu/index.php?ref=" + _root.fond._url;
}
Symbol 70 Button
on (press) {
if (thesound == 1) {
_root.selecte.start(0);
}
_root.play();
}
Symbol 72 Button
on (release) {
if (_root.thesound == 0) {
_root.snd_ok._alpha = 0;
_root.thesound = 1;
stopAllSounds();
_root.error.start(0, 1);
} else {
_root.snd_ok._alpha = 100;
_root.thesound = 0;
}
}