STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228128
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/82785335?noj=FRM82785335-14DC" width="1" height="1"></div>

Pixel Tetris 3.5.swf

This is the info page for
Flash #65259

(Click the ID number above for more basic data on this flash file.)


Text
if you Don't see this on
NEWGROUNDS, DEVIANTART,
OR EVEN MY WEBSITE, IT'S
STOLEN!

PLEASE EMAIL or pm me IF YOU
SEE IT ELSEWHERE.

FROILAN123@GMAIL.COM

TM

MUSIC

MUSIC

A-TYPE

A-TYPE

C-TYPE

C-TYPE

B-TYPE

B-TYPE

NO MUSIC

NO MUSIC

BACK TO Title screen

BACK TO Title screen

Controls

Controls

BACKGROUND

BACKGROUND

st. B's cathedral

(night)

st. B's cathedral

(night)

(DAY)

(DAY)

None

None

BACK TO TITLE SCREEN

BACK TO TITLE SCREEN

Back to music

Back to music

Score

Level

Lines

:

Rotate a block by 90 Degrees

Accelerate a block's speed

move a block to the left

move a block to the right

Controls

Back to title screen

Back to title screen

Back to music

Back to music

"p"

:

Pause the GAME

ActionScript [AS1/AS2]

Frame 2
_root._quality = "LOW"; stop(); stop();
Frame 3
stopAllSounds();
Frame 4
stop(); stopAllSounds();
Frame 5
stop();
Frame 6
stop();
Frame 7
stop();
Frame 8
stop();
Frame 9
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 10
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop(); stop();
Frame 11
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 12
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 13
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 14
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 15
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 16
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop(); stop();
Frame 17
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 18
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop();
Frame 19
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop(); stop(); stop();
Frame 20
var unitsize = 20; var unitheight = 20; var unitwidth = 10; var piececount = 0; var piecetype; var oldlines = 0; var speed = 35; var frame = 1; var level = 1; var realpaused = false; var levelspeed = 18; lines = 0; score = 0; moviecliplist = new Array(); xx = new Array("1", "2", "3", "4"); yy = new Array("1", "1", "1", "1"); framecount = 0; var paused = true; var rotatedcount = 0; unitmap = new Array(); var i = 0; while (i < unitwidth) { unitmap[i] = new Array(); unitmap[i][unitheight + 1] = 1; i++; } mouseListener = new Object(); mouseListener.onMouseDown = function () { if (paused && (realpaused == false)) { var _local2 = 0; while (_local2 <= unitheight) { var _local1 = 0; while (_local1 <= unitwidth) { unitmap[_local1][_local2] = undefined; _local1++; } _local2++; } _local2 = 0; while (_local2 < moviecliplist.length) { removeMovieClip(moviecliplist[_local2]); _local2++; } startgame(); } }; Mouse.addListener(mouseListener); keyListener = new Object(); keyListener.onKeyDown = function () { var _local2 = Key.getCode(); if (paused) { if (_local2 == 80) { paused = false; } } else { if (_local2 == 80) { realpaused = true; paused = true; } if (_local2 == 38) { if (piecetype == 0) { if (rotatedcount == 0) { if ((((unitmap[xx[0] + 2][yy[0] - 1] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 2] == undefined)) { xx[0] = xx[0] + 2; yy[0] = yy[0] - 1; xx[1] = xx[1] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 2; rotatedcount++; } } else if (((((((unitmap[xx[0] - 2][yy[0] + 1] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2]][yy[2] - 1] == undefined)) && (unitmap[xx[3] + 1][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) && (currentpiece._x != 20)) && (currentpiece._x != 180)) { xx[0] = xx[0] - 2; yy[0] = yy[0] + 1; xx[1] = xx[1] - 1; yy[2] = yy[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] - 2; rotatedcount = 0; } reposition(); } else if (piecetype == 1) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2] - 2] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; yy[2] = yy[2] - 2; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3] + 1] == undefined)) { yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[2] = yy[2] + 1; xx[3] = xx[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 2) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0] - 1] == undefined) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; xx[2] = xx[2] + 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (rotatedcount == 1) { if ((((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2] + 1][yy[2] - 1] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; xx[2] = xx[2] + 1; yy[2] = yy[2] - 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (((unitmap[xx[0]][yy[0] - 1] == undefined) && (unitmap[xx[2] - 1][yy[2] + 1] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) { yy[0] = yy[0] - 1; xx[2] = xx[2] - 1; yy[2] = yy[2] + 1; xx[3] = xx[3] - 1; rotatedcount++; } } else if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3] + 1] == undefined)) && (xx[0] != 8)) { yy[0] = yy[0] + 1; xx[2] = xx[2] - 1; xx[3] = xx[3] + 1; yy[3] = yy[3] + 1; rotatedcount = 0; } reposition(); } else if (piecetype == 4) { if (rotatedcount == 0) { if ((unitmap[xx[0] + 1][yy[0] - 2] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 2; xx[1] = xx[1] + 1; rotatedcount++; } } else if (((unitmap[xx[0] - 1][yy[0] + 2] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 2; xx[1] = xx[1] - 1; rotatedcount = 0; } reposition(); } else if (piecetype == 5) { if (rotatedcount == 0) { if (((unitmap[xx[0] + 1][yy[0]] == undefined) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] - 2] == undefined)) { xx[0] = xx[0] + 1; xx[1] = xx[1] + 1; yy[3] = yy[3] - 2; rotatedcount++; } } else if ((((unitmap[xx[0] - 1][yy[0]] == undefined) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[3]][yy[3] + 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; xx[1] = xx[1] - 1; yy[3] = yy[3] + 2; rotatedcount = 0; } reposition(); } else if (piecetype == 6) { if (rotatedcount == 0) { if (unitmap[xx[0] + 1][yy[0] - 1] == undefined) { xx[0] = xx[0] + 1; yy[0] = yy[0] - 1; rotatedcount++; } } else if (rotatedcount == 1) { if (((unitmap[xx[0] - 1][yy[0] + 1] == undefined) && (unitmap[xx[2]][yy[2] - 2] == undefined)) && (currentpiece._x != 0)) { xx[0] = xx[0] - 1; yy[0] = yy[0] + 1; yy[2] = yy[2] - 2; rotatedcount++; } } else if (rotatedcount == 2) { if (unitmap[xx[3] - 1][yy[3] + 1] == undefined) { xx[3] = xx[3] - 1; yy[3] = yy[3] + 1; rotatedcount++; } } else if (((unitmap[xx[2]][yy[2] + 2] == undefined) && (unitmap[xx[3] + 1][yy[3] - 1] == undefined)) && (currentpiece._x != 160)) { yy[2] = yy[2] + 2; xx[3] = xx[3] + 1; yy[3] = yy[3] - 1; rotatedcount = 0; } reposition(); } } if ((((((((((_local2 == 39) && (current4piece._x != 180)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]++; _local1++; } reposition(); } if ((((((((((_local2 == 37) && (currentpiece._x != 0)) && (unitmap[xx[0] - 1][yy[0]] == undefined)) && (unitmap[xx[1] - 1][yy[1]] == undefined)) && (unitmap[xx[2] - 1][yy[2]] == undefined)) && (unitmap[xx[3] - 1][yy[3]] == undefined)) && (unitmap[xx[0] + 1][yy[0]] == undefined)) && (unitmap[xx[1] + 1][yy[1]] == undefined)) && (unitmap[xx[2] + 1][yy[2]] == undefined)) && (unitmap[xx[3] + 1][yy[3]] == undefined)) { var _local1 = 0; while (_local1 < 4) { xx[_local1]--; _local1++; } reposition(); } } }; Key.addListener(keyListener); gameover = function () { popup.swapDepths(5000); popup.gotoAndStop(2); realpaused = false; paused = true; }; reposition = function () { currentpiece._x = xx[0] * unitsize; current2piece._x = xx[1] * unitsize; current3piece._x = xx[2] * unitsize; current4piece._x = xx[3] * unitsize; currentpiece._y = yy[0] * unitsize; current2piece._y = yy[1] * unitsize; current3piece._y = yy[2] * unitsize; current4piece._y = yy[3] * unitsize; }; startgame = function () { paused = false; score = 0; lines = 0; level = 1; popup.gotoAndStop(3); newpiece(); }; newpieceattach = function () { if ((((unitmap[3][0] != undefined) || (unitmap[4][0] != undefined)) || (unitmap[5][0] != undefined)) || (unitmap[6][0] != undefined)) { gameover(); } else { oldlines = 0; var _local1 = 0; while (_local1 <= unitheight) { if ((((((((((unitmap[0][_local1] != undefined) && (unitmap[1][_local1] != undefined)) && (unitmap[2][_local1] != undefined)) && (unitmap[3][_local1] != undefined)) && (unitmap[4][_local1] != undefined)) && (unitmap[5][_local1] != undefined)) && (unitmap[6][_local1] != undefined)) && (unitmap[7][_local1] != undefined)) && (unitmap[8][_local1] != undefined)) && (unitmap[9][_local1] != undefined)) { var _local3 = 0; while (_local3 < unitwidth) { removeMovieClip(unitmap[_local3][_local1]); var _local2 = 0; while (_local2 < unitheight) { unitmap[_local3][_local1 - _local2]._y = unitmap[_local3][_local1 - _local2]._y + unitsize; unitmap[_local3][_local1 - _local2] = unitmap[_local3][(_local1 - _local2) - 1]; _local2++; } _local3++; } oldlines++; score = score + (((level * oldlines) * oldlines) * 100); lines++; if (((lines % 10) == 0) && (levelspeed > 1)) { levelspeed--; level++; } } _local1++; } xx[0] = xx[0] + 3; xx[1] = xx[1] + 3; xx[2] = xx[2] + 3; xx[3] = xx[3] + 3; _root.attachMovie("piece", "currentpiece" + piececount, piececount * 4); this["currentpiece" + piececount]._x = xx[0] * unitsize; this["currentpiece" + piececount]._y = yy[0] * unitsize; this["currentpiece" + piececount]._width = unitsize; this["currentpiece" + piececount]._height = unitsize; _root.attachMovie("piece", "current2piece" + piececount, (piececount * 4) + 1); this["current2piece" + piececount]._x = xx[1] * unitsize; this["current2piece" + piececount]._y = yy[1] * unitsize; this["current2piece" + piececount]._width = unitsize; this["current2piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current3piece" + piececount, (piececount * 4) + 2); this["current3piece" + piececount]._x = xx[2] * unitsize; this["current3piece" + piececount]._y = yy[2] * unitsize; this["current3piece" + piececount]._width = unitsize; this["current3piece" + piececount]._height = unitsize; _root.attachMovie("piece", "current4piece" + piececount, (piececount * 4) + 3); this["current4piece" + piececount]._x = xx[3] * unitsize; this["current4piece" + piececount]._y = yy[3] * unitsize; this["current4piece" + piececount]._width = unitsize; this["current4piece" + piececount]._height = unitsize; currentpiece = _root["currentpiece" + piececount]; currentpiece.gotoAndStop(frame); current2piece = _root["current2piece" + piececount]; current2piece.gotoAndStop(frame); current3piece = _root["current3piece" + piececount]; current3piece.gotoAndStop(frame); current4piece = _root["current4piece" + piececount]; current4piece.gotoAndStop(frame); moviecliplist.push(currentpiece); moviecliplist.push(current2piece); moviecliplist.push(current3piece); moviecliplist.push(current4piece); } }; newpiece = function () { rotatedcount = 0; piececount++; var _local2 = Math.floor(Math.random() * 7); frame = _local2 + 1; piecetype = _local2; if (_local2 == 0) { var _local1 = 0; while (_local1 < 4) { xx[_local1] = _local1; yy[_local1] = 0; _local1++; } } else if (_local2 == 1) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 2; yy[2] = 0; xx[3] = 2; yy[3] = 1; } else if (_local2 == 2) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 0; yy[2] = 1; xx[3] = 2; yy[3] = 0; } else if (_local2 == 3) { xx[0] = 0; yy[0] = 0; xx[1] = 0; yy[1] = 1; xx[2] = 1; yy[2] = 1; xx[3] = 1; yy[3] = 0; } else if (_local2 == 4) { xx[0] = 0; yy[0] = 1; xx[1] = 1; yy[1] = 1; xx[2] = 1; yy[2] = 0; xx[3] = 2; yy[3] = 0; } else if (_local2 == 5) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 1; } else if (_local2 == 6) { xx[0] = 0; yy[0] = 0; xx[1] = 1; yy[1] = 0; xx[2] = 1; yy[2] = 1; xx[3] = 2; yy[3] = 0; } newpieceattach(); }; _root.onEnterFrame = function () { framecount++; current4piece._y = (yy[3] - 1) * unitsize; current3piece._y = (yy[2] - 1) * unitsize; current2piece._y = (yy[1] - 1) * unitsize; currentpiece._y = (yy[0] - 1) * unitsize; if (Key.isDown(40) && (!paused)) { score = score + level; speed = 1; } else { speed = levelspeed; } if ((framecount % speed) == 0) { if (!paused) { if ((((unitmap[xx[0]][yy[0] + 1] == undefined) && (unitmap[xx[1]][yy[1] + 1] == undefined)) && (unitmap[xx[2]][yy[2] + 1] == undefined)) && (unitmap[xx[3]][yy[3] + 1] == undefined)) { current4piece._y = yy[3] * unitsize; current3piece._y = yy[2] * unitsize; current2piece._y = yy[1] * unitsize; currentpiece._y = yy[0] * unitsize; var _local1 = 0; while (_local1 < 4) { yy[_local1]++; _local1++; } } else { unitmap[xx[0]][yy[0]] = currentpiece; unitmap[xx[1]][yy[1]] = current2piece; unitmap[xx[2]][yy[2]] = current3piece; unitmap[xx[3]][yy[3]] = current4piece; newpiece(); framecount = 7; } } } }; stop();
Frame 21
stop(); stopAllSounds();
Symbol 8 MovieClip [piece] Frame 1
stop();
Symbol 19 MovieClip Frame 1
_root.stop(); PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100; if (PercentLoaded != 100) { bar._xscale = PercentLoaded; } else { gotoAndPlay ("loaded"); }
Symbol 19 MovieClip Frame 2
gotoAndPlay (1);
Symbol 19 MovieClip Frame 40
_root.play();
Symbol 51 Button
on (release) { gotoAndPlay (3); }
Symbol 64 Button
on (release) { gotoAndPlay (5); }
Symbol 68 Button
on (release) { gotoAndPlay (7); }
Symbol 72 Button
on (release) { gotoAndPlay (6); }
Symbol 76 Button
on (release) { gotoAndPlay (8); }
Symbol 80 Button
on (release) { gotoAndPlay (2); }
Symbol 85 Button
on (release) { gotoAndPlay (21); }
Symbol 97 Button
on (release) { gotoAndPlay (9); }
Symbol 101 Button
on (release) { gotoAndPlay (10); }
Symbol 105 Button
on (release) { gotoAndPlay (11); }
Symbol 109 Button
on (release) { gotoAndPlay (2); }
Symbol 113 Button
on (release) { gotoAndPlay (4); }
Symbol 114 Button
on (release) { gotoAndPlay (12); }
Symbol 115 Button
on (release) { gotoAndPlay (13); }
Symbol 116 Button
on (release) { gotoAndPlay (14); }
Symbol 117 Button
on (release) { gotoAndPlay (15); }
Symbol 118 Button
on (release) { gotoAndPlay (16); }
Symbol 119 Button
on (release) { gotoAndPlay (17); }
Symbol 120 Button
on (release) { gotoAndPlay (3); }
Symbol 121 Button
on (release) { gotoAndPlay (18); }
Symbol 122 Button
on (release) { gotoAndPlay (19); }
Symbol 123 Button
on (release) { gotoAndPlay (20); }
Symbol 135 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 2
stop();
Symbol 229 Button
on (release) { gotoAndPlay (2); }
Symbol 233 Button
on (release) { gotoAndPlay (4); }

Library Items

Symbol 1 GraphicUsed by:8
Symbol 2 GraphicUsed by:8
Symbol 3 GraphicUsed by:8
Symbol 4 GraphicUsed by:8
Symbol 5 GraphicUsed by:8
Symbol 6 GraphicUsed by:8
Symbol 7 GraphicUsed by:8
Symbol 8 MovieClip [piece]Uses:1 2 3 4 5 6 7
Symbol 9 GraphicUsed by:Timeline
Symbol 10 GraphicUsed by:19
Symbol 11 GraphicUsed by:19
Symbol 12 GraphicUsed by:13
Symbol 13 MovieClipUses:12Used by:19
Symbol 14 GraphicUsed by:15
Symbol 15 MovieClipUses:14Used by:19
Symbol 16 ShapeTweeningUsed by:19
Symbol 17 ShapeTweeningUsed by:19
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClipUses:10 11 13 15 16 17 18Used by:Timeline
Symbol 20 FontUsed by:21 22 23 48 57 59 61 62 65 66 69 70 73 74 77 78 87 89 106 107 110 111 128 129 136 137 156 157 165 166 167 171 172 173 177 178 179 183 184 185 187 188 189 191 192 193 196 197 198 200 201 202 204 205 206 208 209 210 212 213 214 219 220 221 222 226 227 230 231 236
Symbol 21 TextUses:20Used by:Timeline
Symbol 22 TextUses:20Used by:Timeline
Symbol 23 TextUses:20Used by:Timeline
Symbol 24 GraphicUsed by:Timeline
Symbol 25 GraphicUsed by:31 51
Symbol 26 GraphicUsed by:31
Symbol 27 GraphicUsed by:31
Symbol 28 GraphicUsed by:31
Symbol 29 GraphicUsed by:31
Symbol 30 GraphicUsed by:31
Symbol 31 MovieClipUses:25 26 27 28 29 30Used by:Timeline
Symbol 32 GraphicUsed by:33
Symbol 33 MovieClipUses:32Used by:36  Timeline
Symbol 34 GraphicUsed by:35 42
Symbol 35 MovieClipUses:34Used by:36  Timeline
Symbol 36 MovieClipUses:33 35Used by:Timeline
Symbol 37 GraphicUsed by:38
Symbol 38 MovieClipUses:37Used by:Timeline
Symbol 39 GraphicUsed by:40
Symbol 40 MovieClipUses:39Used by:41 124
Symbol 41 MovieClipUses:40Used by:Timeline
Symbol 42 MovieClipUses:34Used by:43 52 54
Symbol 43 MovieClipUses:42Used by:Timeline
Symbol 44 GraphicUsed by:45
Symbol 45 MovieClipUses:44Used by:Timeline
Symbol 46 GraphicUsed by:47
Symbol 47 MovieClipUses:46Used by:Timeline
Symbol 48 TextUses:20Used by:Timeline
Symbol 49 GraphicUsed by:50 51
Symbol 50 MovieClipUses:49Used by:51
Symbol 51 ButtonUses:50 25 49Used by:Timeline
Symbol 52 MovieClipUses:42Used by:Timeline
Symbol 53 SoundUsed by:Timeline
Symbol 54 MovieClipUses:42Used by:55
Symbol 55 MovieClipUses:54Used by:Timeline
Symbol 56 GraphicUsed by:Timeline
Symbol 57 TextUses:20Used by:58
Symbol 58 MovieClipUses:57Used by:Timeline
Symbol 59 TextUses:20Used by:60
Symbol 60 MovieClipUses:59Used by:Timeline
Symbol 61 TextUses:20Used by:64
Symbol 62 TextUses:20Used by:64
Symbol 63 GraphicUsed by:64
Symbol 64 ButtonUses:61 62 63Used by:Timeline
Symbol 65 TextUses:20Used by:68
Symbol 66 TextUses:20Used by:68
Symbol 67 GraphicUsed by:68
Symbol 68 ButtonUses:65 66 67Used by:Timeline
Symbol 69 TextUses:20Used by:72
Symbol 70 TextUses:20Used by:72
Symbol 71 GraphicUsed by:72
Symbol 72 ButtonUses:69 70 71Used by:Timeline
Symbol 73 TextUses:20Used by:76
Symbol 74 TextUses:20Used by:76
Symbol 75 GraphicUsed by:76
Symbol 76 ButtonUses:73 74 75Used by:Timeline
Symbol 77 TextUses:20Used by:80
Symbol 78 TextUses:20Used by:80
Symbol 79 GraphicUsed by:80
Symbol 80 ButtonUses:77 78 79Used by:Timeline
Symbol 81 FontUsed by:82 83 218 223 234 235
Symbol 82 TextUses:81Used by:85 225
Symbol 83 TextUses:81Used by:85
Symbol 84 GraphicUsed by:85
Symbol 85 ButtonUses:82 83 84Used by:Timeline
Symbol 86 GraphicUsed by:Timeline
Symbol 87 TextUses:20Used by:88
Symbol 88 MovieClipUses:87Used by:Timeline
Symbol 89 TextUses:20Used by:90
Symbol 90 MovieClipUses:89Used by:Timeline
Symbol 91 FontUsed by:92 93 94 95 98 99 102 103
Symbol 92 TextUses:91Used by:97 101 114 115 117 118 121 122
Symbol 93 TextUses:91Used by:97 114 117 121
Symbol 94 TextUses:91Used by:97 101 114 115 117 118 121 122
Symbol 95 TextUses:91Used by:97 114 117 121
Symbol 96 GraphicUsed by:97 114 117 121
Symbol 97 ButtonUses:92 93 94 95 96Used by:Timeline
Symbol 98 TextUses:91Used by:101 115 118 122
Symbol 99 TextUses:91Used by:101 115 118 122
Symbol 100 GraphicUsed by:101 115 118 122
Symbol 101 ButtonUses:92 98 94 99 100Used by:Timeline
Symbol 102 TextUses:91Used by:105 116 119 123
Symbol 103 TextUses:91Used by:105 116 119 123
Symbol 104 GraphicUsed by:105 116 119 123
Symbol 105 ButtonUses:102 103 104Used by:Timeline
Symbol 106 TextUses:20Used by:109
Symbol 107 TextUses:20Used by:109
Symbol 108 GraphicUsed by:109
Symbol 109 ButtonUses:106 107 108Used by:Timeline
Symbol 110 TextUses:20Used by:113 120
Symbol 111 TextUses:20Used by:113 120
Symbol 112 GraphicUsed by:113 120
Symbol 113 ButtonUses:110 111 112Used by:Timeline
Symbol 114 ButtonUses:92 93 94 95 96Used by:Timeline
Symbol 115 ButtonUses:92 98 94 99 100Used by:Timeline
Symbol 116 ButtonUses:102 103 104Used by:Timeline
Symbol 117 ButtonUses:92 93 94 95 96Used by:Timeline
Symbol 118 ButtonUses:92 98 94 99 100Used by:Timeline
Symbol 119 ButtonUses:102 103 104Used by:Timeline
Symbol 120 ButtonUses:110 111 112Used by:Timeline
Symbol 121 ButtonUses:92 93 94 95 96Used by:Timeline
Symbol 122 ButtonUses:92 98 94 99 100Used by:Timeline
Symbol 123 ButtonUses:102 103 104Used by:Timeline
Symbol 124 MovieClipUses:40Used by:163  Timeline
Symbol 125 GraphicUsed by:Timeline
Symbol 126 GraphicUsed by:127
Symbol 127 MovieClipUses:126Used by:Timeline
Symbol 128 EditableTextUses:20Used by:Timeline
Symbol 129 EditableTextUses:20Used by:Timeline
Symbol 130 GraphicUsed by:131
Symbol 131 MovieClipUses:130Used by:135
Symbol 132 GraphicUsed by:135
Symbol 133 GraphicUsed by:134
Symbol 134 ButtonUses:133Used by:135
Symbol 135 MovieClipUses:131 132 134Used by:Timeline
Symbol 136 EditableTextUses:20Used by:Timeline
Symbol 137 TextUses:20Used by:Timeline
Symbol 138 GraphicUsed by:139
Symbol 139 MovieClipUses:138Used by:Timeline
Symbol 140 GraphicUsed by:141
Symbol 141 MovieClipUses:140Used by:Timeline
Symbol 142 GraphicUsed by:143
Symbol 143 MovieClipUses:142Used by:Timeline
Symbol 144 GraphicUsed by:145
Symbol 145 MovieClipUses:144Used by:Timeline
Symbol 146 GraphicUsed by:147
Symbol 147 MovieClipUses:146Used by:Timeline
Symbol 148 GraphicUsed by:149
Symbol 149 MovieClipUses:148Used by:Timeline
Symbol 150 GraphicUsed by:151
Symbol 151 MovieClipUses:150Used by:Timeline
Symbol 152 GraphicUsed by:153
Symbol 153 MovieClipUses:152Used by:Timeline
Symbol 154 GraphicUsed by:155
Symbol 155 MovieClipUses:154Used by:Timeline
Symbol 156 TextUses:20Used by:Timeline
Symbol 157 TextUses:20Used by:Timeline
Symbol 158 GraphicUsed by:159
Symbol 159 MovieClipUses:158Used by:Timeline
Symbol 160 SoundUsed by:Timeline
Symbol 161 GraphicUsed by:162
Symbol 162 MovieClipUses:161Used by:Timeline
Symbol 163 MovieClipUses:124Used by:Timeline
Symbol 164 GraphicUsed by:Timeline
Symbol 165 EditableTextUses:20Used by:Timeline
Symbol 166 EditableTextUses:20Used by:Timeline
Symbol 167 EditableTextUses:20Used by:Timeline
Symbol 168 GraphicUsed by:169
Symbol 169 MovieClipUses:168Used by:Timeline
Symbol 170 GraphicUsed by:Timeline
Symbol 171 EditableTextUses:20Used by:Timeline
Symbol 172 EditableTextUses:20Used by:Timeline
Symbol 173 EditableTextUses:20Used by:Timeline
Symbol 174 GraphicUsed by:175
Symbol 175 MovieClipUses:174Used by:Timeline
Symbol 176 GraphicUsed by:Timeline
Symbol 177 EditableTextUses:20Used by:Timeline
Symbol 178 EditableTextUses:20Used by:Timeline
Symbol 179 EditableTextUses:20Used by:Timeline
Symbol 180 GraphicUsed by:181
Symbol 181 MovieClipUses:180Used by:Timeline
Symbol 182 SoundUsed by:Timeline
Symbol 183 EditableTextUses:20Used by:Timeline
Symbol 184 EditableTextUses:20Used by:Timeline
Symbol 185 EditableTextUses:20Used by:Timeline
Symbol 186 GraphicUsed by:Timeline
Symbol 187 EditableTextUses:20Used by:Timeline
Symbol 188 EditableTextUses:20Used by:Timeline
Symbol 189 EditableTextUses:20Used by:Timeline
Symbol 190 GraphicUsed by:Timeline
Symbol 191 EditableTextUses:20Used by:Timeline
Symbol 192 EditableTextUses:20Used by:Timeline
Symbol 193 EditableTextUses:20Used by:Timeline
Symbol 194 SoundUsed by:Timeline
Symbol 195 GraphicUsed by:Timeline
Symbol 196 EditableTextUses:20Used by:Timeline
Symbol 197 EditableTextUses:20Used by:Timeline
Symbol 198 EditableTextUses:20Used by:Timeline
Symbol 199 GraphicUsed by:Timeline
Symbol 200 EditableTextUses:20Used by:Timeline
Symbol 201 EditableTextUses:20Used by:Timeline
Symbol 202 EditableTextUses:20Used by:Timeline
Symbol 203 GraphicUsed by:Timeline
Symbol 204 EditableTextUses:20Used by:Timeline
Symbol 205 EditableTextUses:20Used by:Timeline
Symbol 206 EditableTextUses:20Used by:Timeline
Symbol 207 GraphicUsed by:Timeline
Symbol 208 EditableTextUses:20Used by:Timeline
Symbol 209 EditableTextUses:20Used by:Timeline
Symbol 210 EditableTextUses:20Used by:Timeline
Symbol 211 GraphicUsed by:Timeline
Symbol 212 EditableTextUses:20Used by:Timeline
Symbol 213 EditableTextUses:20Used by:Timeline
Symbol 214 EditableTextUses:20Used by:Timeline
Symbol 215 GraphicUsed by:Timeline
Symbol 216 GraphicUsed by:217
Symbol 217 MovieClipUses:216Used by:Timeline
Symbol 218 TextUses:81Used by:Timeline
Symbol 219 TextUses:20Used by:Timeline
Symbol 220 TextUses:20Used by:Timeline
Symbol 221 TextUses:20Used by:Timeline
Symbol 222 TextUses:20Used by:Timeline
Symbol 223 TextUses:81Used by:224
Symbol 224 MovieClipUses:223Used by:Timeline
Symbol 225 MovieClipUses:82Used by:Timeline
Symbol 226 TextUses:20Used by:229
Symbol 227 TextUses:20Used by:229
Symbol 228 GraphicUsed by:229
Symbol 229 ButtonUses:226 227 228Used by:Timeline
Symbol 230 TextUses:20Used by:233
Symbol 231 TextUses:20Used by:233
Symbol 232 GraphicUsed by:233
Symbol 233 ButtonUses:230 231 232Used by:Timeline
Symbol 234 TextUses:81Used by:Timeline
Symbol 235 TextUses:81Used by:Timeline
Symbol 236 TextUses:20Used by:Timeline

Instance Names

"popup"Frame 9Symbol 135 MovieClip
"bar"Symbol 19 MovieClip Frame 1Symbol 13 MovieClip

Special Tags

ExportAssets (56)Timeline Frame 1Symbol 8 as "piece"

Labels

"loaded"Symbol 19 MovieClip Frame 5

Dynamic Text Variables

scoreSymbol 128 EditableText""
linesSymbol 129 EditableText""
levelSymbol 136 EditableText""
scoreSymbol 165 EditableText""
linesSymbol 166 EditableText""
levelSymbol 167 EditableText""
scoreSymbol 171 EditableText""
linesSymbol 172 EditableText""
levelSymbol 173 EditableText""
scoreSymbol 177 EditableText""
linesSymbol 178 EditableText""
levelSymbol 179 EditableText""
scoreSymbol 183 EditableText""
linesSymbol 184 EditableText""
levelSymbol 185 EditableText""
scoreSymbol 187 EditableText""
linesSymbol 188 EditableText""
levelSymbol 189 EditableText""
scoreSymbol 191 EditableText""
linesSymbol 192 EditableText""
levelSymbol 193 EditableText""
scoreSymbol 196 EditableText""
linesSymbol 197 EditableText""
levelSymbol 198 EditableText""
scoreSymbol 200 EditableText""
linesSymbol 201 EditableText""
levelSymbol 202 EditableText""
scoreSymbol 204 EditableText""
linesSymbol 205 EditableText""
levelSymbol 206 EditableText""
scoreSymbol 208 EditableText""
linesSymbol 209 EditableText""
levelSymbol 210 EditableText""
scoreSymbol 212 EditableText""
linesSymbol 213 EditableText""
levelSymbol 214 EditableText""




http://swfchan.com/14/65259/info.shtml
Created: 12/4 -2019 16:29:54 Last modified: 12/4 -2019 16:29:54 Server time: 14/05 -2024 21:45:09