Frame 1
startLevel = 1;
Instance of Symbol 33 MovieClip in Frame 1
onClipEvent (load) {
Mouse.hide();
startDrag (this, true, 0, 0, 550, 550);
}
Frame 2
stopAllSounds();
play();
Frame 50
stop();
String.prototype.addCommas = function () {
var len = this.length;
var str = "";
var i = 0;
while (i <= len) {
str = this.charAt(len - i) + str;
if ((((i % 3) == 0) && (i > 0)) && (i < len)) {
str = "," + str;
}
i++;
}
return(str);
};
game_so = SharedObject.getLocal("neaveTetris");
score = 0;
level = startLevel;
highScores_btn.onRelease = function () {
gotoAndStop (107);
};
neave_btn.onRelease = function () {
getURL ("http://www.neave.com/games/", "_blank");
};
Key.removeListener(this);
Frame 51
stop();
Frame 52
stop();
Frame 53
stop();
checkButtons = function () {
if (startLevel < 2) {
down_btn._alpha = 50;
down_btn.enabled = false;
} else if (startLevel > 9) {
up_btn._alpha = 50;
up_btn.enabled = false;
} else {
up_btn._alpha = (down_btn._alpha = 100);
up_btn.enabled = (down_btn.enabled = true);
}
};
checkButtons();
down_btn.onPress = function () {
startLevel--;
checkButtons();
};
up_btn.onPress = function () {
startLevel++;
checkButtons();
};
ok_btn.onPress = function () {
play();
};
Frame 54
stopAllSounds();
startFall = function () {
timeout = setInterval(down, speed);
};
stopFall = function () {
clearInterval(timeout);
};
drawBlock = function (num, blockPos) {
b_mc[blockPos].gotoAndStop(num + 1);
};
drawNextBlock = function (num, blockPos) {
next_mc[blockPos].gotoAndStop(num + 1);
};
drawThisShape = function () {
if (moved) {
var i = 0;
while (i < 4) {
drawBlock(0, block_array[i]);
i++;
}
} else {
moved = true;
}
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (rotation * 4)) + i];
block_array[i] = ((((blockPos >> 2) * 6) + blockPos) + xPos) + yPos;
drawBlock(thisShape + 1, block_array[i]);
i++;
}
};
drawNextShape = function () {
nextShape = int(Math.random() * 7);
var i = 0;
while (i < 11) {
drawNextBlock(0, i);
i++;
}
var i = 0;
while (i < 4) {
drawNextBlock(nextShape + 1, shape_array[(nextShape * 16) + i]);
i++;
}
};
collision = function (x, y, rot) {
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (rot * 4)) + i];
if (flag_array[((((blockPos >> 2) * 6) + blockPos) + x) + y] != 0) {
return(true);
}
i++;
}
return(false);
};
left = function () {
var i = 0;
while (i < 4) {
var x = (block_array[i] - yPos);
while (x >= 0) {
if (x == 0) {
return(undefined);
}
x = x - 10;
}
i++;
}
if (!collision(xPos - 1, yPos, rotation)) {
xPos--;
drawThisShape();
}
};
right = function () {
var i = 0;
while (i < 4) {
var x = (block_array[i] - yPos);
while (x >= 0) {
if (x == 9) {
return(undefined);
}
x = x - 10;
}
i++;
}
if (!collision(xPos + 1, yPos, rotation)) {
xPos++;
drawThisShape();
}
};
rotate = function (clockwise) {
testRot = rotation;
if (clockwise) {
testRot++;
} else {
testRot--;
}
if (testRot == 4) {
testRot = 0;
} else if (testRot == -1) {
testRot = 3;
}
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (testRot * 4)) + i];
var x = ((((blockPos >> 2) * 6) + blockPos) + xPos);
while (x >= -1) {
if (((x == -1) && (xPos < 0)) || ((x == 0) && (xPos > 6))) {
return(undefined);
}
x = x - 10;
}
i++;
}
if ((((((blockPos >> 2) * 6) + blockPos) + xPos) + yPos) > 179) {
return(undefined);
}
if (!collision(xPos, yPos, testRot)) {
rotation = testRot;
drawThisShape();
sound_mc.gotoAndPlay("popHi");
}
};
down = function () {
if (gameOver || (simult)) {
return(undefined);
}
score++;
if (((block_array[3] - xPos) < 170) && (!collision(xPos, yPos + 10, rotation))) {
yPos = yPos + 10;
drawThisShape();
} else {
var i = 0;
while (i < 4) {
flag_array[block_array[i]] = thisShape + 1;
i++;
}
simult = 0;
var y = 0;
while (y < 180) {
var x = 0;
while (x < 10) {
if (flag_array[x + y] == 0) {
break;
}
if (x == 9) {
stopFall();
var i = 0;
while (i < 10) {
b_mc[i + y].bang_mc.y = y;
b_mc[i + y].bang_mc.play();
i++;
}
simult++;
lines++;
}
x++;
}
y = y + 10;
}
if (simult) {
sound_mc.gotoAndPlay("win");
switch (simult) {
case 1 :
score = score + (level * 40);
break;
case 2 :
score = score + (level * 100);
break;
case 3 :
score = score + (level * 300);
break;
case 4 :
score = score + (level * 1200);
}
}
scoreTxt = String(score).addCommas();
if (collision(xPos, yPos, rotation) && (yPos == -10)) {
gameOver = true;
stopFall();
sound_mc.gotoAndPlay("end");
quitGame_mc.gotoAndStop(2);
quitGame_mc._visible = true;
} else {
level = int(lines / 10) + startLevel;
speed = ((level < 10) ? (600 - (level * 50)) : 100);
xPos = 3;
yPos = -10;
rotation = 0;
moved = false;
thisShape = nextShape;
if (!simult) {
drawNextShape();
drawThisShape();
sound_mc.gotoAndPlay("popLo");
}
}
}
updateAfterEvent();
};
this.onKeyDown = function () {
if (gameOver || (simult)) {
return(undefined);
}
var keyCode = Key.getCode();
switch (keyCode) {
case 80 :
pause_btn.onPress();
break;
case 81 :
quit_btn.onPress();
}
if (!paused) {
switch (keyCode) {
case Key.LEFT :
left();
break;
case Key.RIGHT :
right();
break;
case Key.DOWN :
this.onEnterFrame = down;
break;
case Key.UP :
case 88 :
rotate(true);
break;
case 90 :
rotate(false);
}
}
updateAfterEvent();
};
this.onKeyUp = function () {
delete this.onEnterFrame;
};
Key.removeListener(this);
Key.addListener(this);
gameOver = true;
paused = (moved = false);
score = (scoreTxt = (lines = (thisShape = (nextShape = (rotation = 0)))));
level = startLevel;
speed = ((level < 10) ? (600 - (level * 50)) : 100);
xPos = 3;
yPos = -10;
shape_array = new Array(5, 6, 9, 10, 5, 6, 9, 10, 5, 6, 9, 10, 5, 6, 9, 10, 4, 5, 6, 9, 1, 4, 5, 9, 1, 4, 5, 6, 1, 5, 6, 9, 4, 5, 9, 10, 2, 5, 6, 9, 4, 5, 9, 10, 2, 5, 6, 9, 5, 6, 8, 9, 1, 5, 6, 10, 5, 6, 8, 9, 1, 5, 6, 10, 4, 5, 6, 8, 0, 1, 5, 9, 2, 4, 5, 6, 1, 5, 9, 10, 4, 5, 6, 10, 1, 5, 8, 9, 0, 4, 5, 6, 1, 2, 5, 9, 4, 5, 6, 7, 1, 5, 9, 13, 4, 5, 6, 7, 1, 5, 9, 13);
block_array = new Array(0, 0, 0, 0);
flag_array = new Array();
var i = 18;
while (i >= 0) {
var j = 0;
while (j < 10) {
var k = ((i * 10) + j);
b_mc.attachMovie("block", k, k, {_x:j * 20, _y:i * 20});
flag_array[k] = 0;
j++;
}
i--;
}
var i = 0;
while (i < 3) {
var j = 0;
while (j < 4) {
var k = ((i * 4) + j);
next_mc.attachMovie("block", k, k, {_x:j * 20, _y:i * 20});
j++;
}
i++;
}
Instance of Symbol 33 MovieClip in Frame 54
onClipEvent (load) {
Mouse.hide();
startDrag (this, true, 0, 0, 550, 550);
}
Frame 102
startFall = function () {
timeout = setInterval(down, speed);
};
stopFall = function () {
clearInterval(timeout);
};
drawBlock = function (num, blockPos) {
b_mc[blockPos].gotoAndStop(num + 1);
};
drawNextBlock = function (num, blockPos) {
next_mc[blockPos].gotoAndStop(num + 1);
};
drawThisShape = function () {
if (moved) {
var i = 0;
while (i < 4) {
drawBlock(0, block_array[i]);
i++;
}
} else {
moved = true;
}
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (rotation * 4)) + i];
block_array[i] = ((((blockPos >> 2) * 6) + blockPos) + xPos) + yPos;
drawBlock(thisShape + 1, block_array[i]);
i++;
}
};
drawNextShape = function () {
nextShape = int(Math.random() * 7);
var i = 0;
while (i < 11) {
drawNextBlock(0, i);
i++;
}
var i = 0;
while (i < 4) {
drawNextBlock(nextShape + 1, shape_array[(nextShape * 16) + i]);
i++;
}
};
collision = function (x, y, rot) {
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (rot * 4)) + i];
if (flag_array[((((blockPos >> 2) * 6) + blockPos) + x) + y] != 0) {
return(true);
}
i++;
}
return(false);
};
left = function () {
var i = 0;
while (i < 4) {
var x = (block_array[i] - yPos);
while (x >= 0) {
if (x == 0) {
return(undefined);
}
x = x - 10;
}
i++;
}
if (!collision(xPos - 1, yPos, rotation)) {
xPos--;
drawThisShape();
}
};
right = function () {
var i = 0;
while (i < 4) {
var x = (block_array[i] - yPos);
while (x >= 0) {
if (x == 9) {
return(undefined);
}
x = x - 10;
}
i++;
}
if (!collision(xPos + 1, yPos, rotation)) {
xPos++;
drawThisShape();
}
};
rotate = function (clockwise) {
testRot = rotation;
if (clockwise) {
testRot++;
} else {
testRot--;
}
if (testRot == 4) {
testRot = 0;
} else if (testRot == -1) {
testRot = 3;
}
var i = 0;
while (i < 4) {
blockPos = shape_array[((thisShape * 16) + (testRot * 4)) + i];
var x = ((((blockPos >> 2) * 6) + blockPos) + xPos);
while (x >= -1) {
if (((x == -1) && (xPos < 0)) || ((x == 0) && (xPos > 6))) {
return(undefined);
}
x = x - 10;
}
i++;
}
if ((((((blockPos >> 2) * 6) + blockPos) + xPos) + yPos) > 179) {
return(undefined);
}
if (!collision(xPos, yPos, testRot)) {
rotation = testRot;
drawThisShape();
sound_mc.gotoAndPlay("popHi");
}
};
down = function () {
if (gameOver || (simult)) {
return(undefined);
}
score++;
if (((block_array[3] - xPos) < 170) && (!collision(xPos, yPos + 10, rotation))) {
yPos = yPos + 10;
drawThisShape();
} else {
var i = 0;
while (i < 4) {
flag_array[block_array[i]] = thisShape + 1;
i++;
}
simult = 0;
var y = 0;
while (y < 180) {
var x = 0;
while (x < 10) {
if (flag_array[x + y] == 0) {
break;
}
if (x == 9) {
stopFall();
var i = 0;
while (i < 10) {
b_mc[i + y].bang_mc.y = y;
b_mc[i + y].bang_mc.play();
i++;
}
simult++;
lines++;
}
x++;
}
y = y + 10;
}
if (simult) {
sound_mc.gotoAndPlay("win");
switch (simult) {
case 1 :
score = score + (level * 40);
break;
case 2 :
score = score + (level * 100);
break;
case 3 :
score = score + (level * 300);
break;
case 4 :
score = score + (level * 1200);
}
}
scoreTxt = String(score).addCommas();
if (collision(xPos, yPos, rotation) && (yPos == -10)) {
gameOver = true;
stopFall();
sound_mc.gotoAndPlay("end");
quitGame_mc.gotoAndStop(2);
quitGame_mc._visible = true;
} else {
level = int(lines / 10) + startLevel;
speed = ((level < 10) ? (600 - (level * 50)) : 100);
xPos = 3;
yPos = -10;
rotation = 0;
moved = false;
thisShape = nextShape;
if (!simult) {
drawNextShape();
drawThisShape();
sound_mc.gotoAndPlay("popLo");
}
}
}
updateAfterEvent();
};
this.onKeyDown = function () {
if (gameOver || (simult)) {
return(undefined);
}
var keyCode = Key.getCode();
if (!(keyCode === 80)) {
} else {
pause_btn.onPress();
}
if (!paused) {
switch (keyCode) {
case Key.LEFT :
left();
break;
case Key.RIGHT :
right();
break;
case Key.DOWN :
this.onEnterFrame = down;
break;
case Key.UP :
case 88 :
rotate(true);
break;
case 90 :
rotate(false);
}
}
updateAfterEvent();
};
this.onKeyUp = function () {
delete this.onEnterFrame;
};
Key.removeListener(this);
Key.addListener(this);
gameOver = true;
paused = (moved = false);
score = (scoreTxt = (lines = (thisShape = (nextShape = (rotation = 0)))));
level = startLevel;
speed = ((level < 10) ? (600 - (level * 50)) : 100);
xPos = 3;
yPos = -10;
shape_array = new Array(5, 6, 9, 10, 5, 6, 9, 10, 5, 6, 9, 10, 5, 6, 9, 10, 4, 5, 6, 9, 1, 4, 5, 9, 1, 4, 5, 6, 1, 5, 6, 9, 4, 5, 9, 10, 2, 5, 6, 9, 4, 5, 9, 10, 2, 5, 6, 9, 5, 6, 8, 9, 1, 5, 6, 10, 5, 6, 8, 9, 1, 5, 6, 10, 4, 5, 6, 8, 0, 1, 5, 9, 2, 4, 5, 6, 1, 5, 9, 10, 4, 5, 6, 10, 1, 5, 8, 9, 0, 4, 5, 6, 1, 2, 5, 9, 4, 5, 6, 7, 1, 5, 9, 13, 4, 5, 6, 7, 1, 5, 9, 13);
block_array = new Array(0, 0, 0, 0);
flag_array = new Array();
var i = 18;
while (i >= 0) {
var j = 0;
while (j < 10) {
var k = ((i * 10) + j);
b_mc.attachMovie("block", k, k, {_x:j * 20, _y:i * 20});
flag_array[k] = 0;
j++;
}
i--;
}
var i = 0;
while (i < 3) {
var j = 0;
while (j < 4) {
var k = ((i * 4) + j);
next_mc.attachMovie("block", k, k, {_x:j * 20, _y:i * 20});
j++;
}
i++;
}
Frame 106
stop();
pause_btn.onPress = function () {
if (gameOver || (quitGame_mc._visible)) {
return(undefined);
}
stopFall();
sound_mc.gotoAndPlay("popMed");
b_mc._visible = !((paused_mc._visible = (paused = !paused)));
if (!paused) {
startFall();
}
};
quit_btn.onPress = function () {
if (gameOver) {
return(undefined);
}
stopFall();
sound_mc.gotoAndPlay("popMed");
b_mc._visible = (paused_mc._visible = false);
quitGame_mc._visible = (paused = true);
};
drawNextShape();
thisShape = nextShape;
drawThisShape();
drawNextShape();
gameOver = false;
stopFall();
startFall();
Frame 107
gotoAndPlay (2);
Symbol 2 MovieClip Frame 1
stop();
Symbol 2 MovieClip Frame 7
x = Number(_parent._name) - y;
with (_root) {
var j = y;
while (j > 0) {
drawBlock((flag_array[x + j] = flag_array[(x + j) - 10]), x + j);
j = j - 10;
}
if (!x) {
simult--;
}
if (!simult) {
drawNextShape();
drawThisShape();
startFall();
}
}
Symbol 10 MovieClip [block] Frame 1
stop();
Symbol 20 Button
on (release) {
_root.play();
}
Symbol 21 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
gotoAndStop (3);
}
Symbol 21 MovieClip Frame 2
gotoAndPlay (1);
Symbol 33 MovieClip Frame 1
stop();
Symbol 35 Button
on (release, keyPress "q") {
nextFrame();
}
Symbol 36 Button
on (release, keyPress "q") {
gotoAndStop (1);
}
Symbol 37 MovieClip Frame 1
stop();
_quality = "BEST";
Symbol 37 MovieClip Frame 2
stop();
_quality = "MEDIUM";
Symbol 37 MovieClip Frame 3
stop();
_quality = "LOW";
Symbol 54 Button
on (release) {
gotoAndStop (51);
}
Symbol 55 Button
on (release) {
gotoAndPlay (53);
}
Symbol 58 Button
on (release) {
gotoAndStop (52);
}
Symbol 68 MovieClip Frame 45
stop();
Symbol 72 Button
on (release) {
gotoAndPlay (50);
}
Symbol 75 Button
on (release) {
_quality = "LOW";
}
Symbol 78 Button
on (release) {
_quality = "MEDIUM";
}
Symbol 81 Button
on (release) {
_quality = "HIGH";
}
Symbol 84 Button
on (release) {
_quality = "BEST";
}
Symbol 108 Button
on (release) {
nextFrame();
}
Symbol 139 Button
on (release) {
play();
}
Symbol 140 MovieClip Frame 1
stop();
Symbol 140 MovieClip Frame 2
stop();
Symbol 140 MovieClip Frame 3
stop();
Symbol 140 MovieClip Frame 4
stop();
Symbol 140 MovieClip Frame 5
stop();
Symbol 140 MovieClip Frame 6
stop();
Symbol 140 MovieClip Frame 7
stop();
Symbol 140 MovieClip Frame 8
stop();
Symbol 140 MovieClip Frame 9
stop();
Symbol 140 MovieClip Frame 10
stop();
Symbol 140 MovieClip Frame 11
stop();
Symbol 140 MovieClip Frame 12
stop();
Symbol 140 MovieClip Frame 13
stop();
Symbol 140 MovieClip Frame 14
stop();
Symbol 140 MovieClip Frame 15
stop();
Symbol 146 Button
on (release) {
play();
}
Symbol 147 Button
on (release) {
gotoAndPlay (35);
}
Symbol 151 Button
on (release) {
gotoAndPlay (1);
}
Symbol 154 Button
on (release) {
gotoAndPlay (3);
}
Symbol 157 Button
on (release) {
gotoAndPlay (5);
}
Symbol 160 Button
on (release) {
gotoAndPlay (7);
}
Symbol 163 Button
on (release) {
gotoAndPlay (9);
}
Symbol 166 Button
on (release) {
gotoAndPlay (11);
}
Symbol 169 Button
on (release) {
gotoAndPlay (13);
}
Symbol 172 Button
on (release) {
gotoAndPlay (15);
}
Symbol 175 Button
on (release) {
gotoAndPlay (17);
}
Symbol 178 Button
on (release) {
gotoAndPlay (19);
}
Symbol 181 Button
on (release) {
gotoAndPlay (21);
}
Symbol 183 Button
on (release) {
gotoAndPlay (23);
}
Symbol 186 Button
on (release) {
gotoAndPlay (25);
}
Symbol 189 Button
on (release) {
gotoAndPlay (27);
}
Symbol 192 Button
on (release) {
gotoAndPlay (29);
}
Symbol 195 Button
on (release) {
gotoAndPlay (31);
}
Symbol 198 Button
on (release) {
gotoAndPlay (33);
}
Symbol 200 MovieClip Frame 1
stopAllSounds();
Symbol 200 MovieClip Frame 2
stop();
Symbol 200 MovieClip Frame 3
stopAllSounds();
Symbol 200 MovieClip Frame 4
stop();
Symbol 200 MovieClip Frame 5
stopAllSounds();
Symbol 200 MovieClip Frame 6
stop();
Symbol 200 MovieClip Frame 7
stopAllSounds();
Symbol 200 MovieClip Frame 8
stop();
Symbol 200 MovieClip Frame 9
stopAllSounds();
Symbol 200 MovieClip Frame 10
stop();
Symbol 200 MovieClip Frame 11
stopAllSounds();
Symbol 200 MovieClip Frame 12
stop();
Symbol 200 MovieClip Frame 13
stopAllSounds();
Symbol 200 MovieClip Frame 14
stop();
Symbol 200 MovieClip Frame 15
stopAllSounds();
Symbol 200 MovieClip Frame 16
stop();
Symbol 200 MovieClip Frame 17
stopAllSounds();
Symbol 200 MovieClip Frame 18
stop();
Symbol 200 MovieClip Frame 19
stopAllSounds();
Symbol 200 MovieClip Frame 20
stop();
Symbol 200 MovieClip Frame 21
stopAllSounds();
Symbol 200 MovieClip Frame 22
stop();
Symbol 200 MovieClip Frame 23
stopAllSounds();
Symbol 200 MovieClip Frame 24
stop();
Symbol 200 MovieClip Frame 25
stopAllSounds();
Symbol 200 MovieClip Frame 26
stop();
Symbol 200 MovieClip Frame 27
stopAllSounds();
Symbol 200 MovieClip Frame 28
stop();
Symbol 200 MovieClip Frame 29
stopAllSounds();
Symbol 200 MovieClip Frame 30
stop();
Symbol 200 MovieClip Frame 31
stopAllSounds();
Symbol 200 MovieClip Frame 32
stop();
Symbol 200 MovieClip Frame 33
stopAllSounds();
Symbol 200 MovieClip Frame 34
stop();
Symbol 200 MovieClip Frame 35
stopAllSounds();
Symbol 200 MovieClip Frame 36
stop();
Symbol 204 MovieClip Frame 1
stop();
Symbol 204 MovieClip Frame 3
stop();
Symbol 204 MovieClip Frame 5
stop();
Symbol 204 MovieClip Frame 7
stop();
Symbol 204 MovieClip Frame 9
stop();
Symbol 223 Button
on (release) {
stopAllSounds();
gotoAndPlay (2);
}
Symbol 232 MovieClip Frame 1
stop();
_visible = false;
yes_btn.onPress = function () {
_root.stopFall();
_root.gotoAndStop(2);
};
no_btn.onPress = function () {
_visible = false;
_root.pause_btn.onPress();
};
yes_btn.onKeyDown = function () {
if (Key.getCode() == 89) {
this.onPress();
}
if (Key.getCode() == 78) {
no_btn.onPress();
}
};
Key.addListener(yes_btn);
Symbol 232 MovieClip Frame 2
stopAllSounds();
play();
Symbol 232 MovieClip Frame 3
_root.pause_btn._visible = (_root.quit_btn._visible = false);
name_txt.restrict = "a-z 0-9.:\\-";
name_txt.text = _root.game_so.data.playerName;
Selection.setFocus(name_txt);
Selection.setSelection(name_txt.length, name_txt.length);
ok_btn.onPress = function () {
if (name_txt.length > 0) {
_root.game_so.data.playerName = name_txt.text;
}
_root.nextFrame();
};
ok_btn.onKeyDown = function () {
if (Key.getCode() == 13) {
Key.removeListener(this);
this.onPress();
}
};
Key.removeListener(yes_btn);
Key.addListener(ok_btn);
stop();
Symbol 235 MovieClip Frame 1
_visible = false;
hit_mc.onPress = _root.pause;