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

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

Pixel Tetris 4.0.swf

This is the info page for
Flash #71237

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


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

PLEASE EMAIL OR PM me IF YOU
SEE IT ELSEWHERE.

(FROILAN123@GMAIL.COM) no Spamming!!!

ver. 4.0

BACK TO Title screen

BACK TO Title screen

Controls

Controls

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

t

f

e

l

h

o

k

c

b

a

v

m

move a block to the right

Back to title screen

Back to title screen

Back to music

Back to music

:

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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 = 39; 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 44 Button
on (release) { gotoAndPlay (3); }
Symbol 62 Button
on (release) { gotoAndPlay (5); }
Symbol 69 Button
on (release) { gotoAndPlay (2); }
Symbol 74 Button
on (release) { gotoAndPlay (21); }
Symbol 77 Button
on (release) { gotoAndPlay (6); }
Symbol 80 Button
on (release) { gotoAndPlay (7); }
Symbol 84 Button
on (release) { gotoAndPlay (8); }
Symbol 88 Button
on (release) { gotoAndPlay (21); }
Symbol 91 Button
on (release) { gotoAndPlay (18); }
Symbol 95 Button
on (release) { gotoAndPlay (2); }
Symbol 99 Button
on (release) { gotoAndPlay (4); }
Symbol 102 Button
on (release) { gotoAndPlay (9); }
Symbol 105 Button
on (release) { gotoAndPlay (19); }
Symbol 106 Button
on (release) { gotoAndPlay (10); }
Symbol 107 Button
on (release) { gotoAndPlay (11); }
Symbol 108 Button
on (release) { gotoAndPlay (182); }
Symbol 109 Button
on (release) { gotoAndPlay (13); }
Symbol 110 Button
on (release) { gotoAndPlay (14); }
Symbol 111 Button
on (release) { gotoAndPlay (15); }
Symbol 112 Button
on (release) { gotoAndPlay (16); }
Symbol 113 Button
on (release) { gotoAndPlay (17); }
Symbol 114 Button
on (release) { gotoAndPlay (20); }
Symbol 128 MovieClip Frame 1
stop();
Symbol 128 MovieClip Frame 2
stop();
Symbol 263 Button
on (release) { gotoAndPlay (2); }
Symbol 267 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 66 67 92 93 96 97 119 120 129 130 149 150 195 196 197 199 200 201 203 204 205 207 208 209 211 212 213 215 216 217 220 221 222 224 225 226 228 229 230 232 233 234 236 237 238 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 264 265 269
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 44
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 168  Timeline
Symbol 34 GraphicUsed by:35
Symbol 35 MovieClipUses:34Used by:36 171  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 115
Symbol 41 MovieClipUses:40Used by:Timeline
Symbol 42 GraphicUsed by:43 44
Symbol 43 MovieClipUses:42Used by:44
Symbol 44 ButtonUses:43 25 42Used by:Timeline
Symbol 45 FontUsed by:46
Symbol 46 TextUses:45Used by:Timeline
Symbol 47 GraphicUsed by:48
Symbol 48 MovieClipUses:47Used by:49 52 176
Symbol 49 MovieClipUses:48Used by:Timeline
Symbol 50 GraphicUsed by:51
Symbol 51 MovieClipUses:50Used by:Timeline
Symbol 52 MovieClipUses:48Used by:Timeline
Symbol 53 GraphicUsed by:54
Symbol 54 MovieClipUses:53Used by:56
Symbol 55 GraphicUsed by:56
Symbol 56 MovieClipUses:54 55Used by:Timeline
Symbol 57 SoundUsed by:Timeline
Symbol 58 GraphicUsed by:Timeline
Symbol 59 GraphicUsed by:60
Symbol 60 MovieClipUses:59Used by:62
Symbol 61 GraphicUsed by:62
Symbol 62 ButtonUses:60 61Used by:Timeline
Symbol 63 GraphicUsed by:64
Symbol 64 MovieClipUses:63Used by:Timeline
Symbol 65 GraphicUsed by:Timeline
Symbol 66 TextUses:20Used by:69
Symbol 67 TextUses:20Used by:69
Symbol 68 GraphicUsed by:69
Symbol 69 ButtonUses:66 67 68Used by:Timeline
Symbol 70 FontUsed by:71 72 244 268
Symbol 71 TextUses:70Used by:74
Symbol 72 TextUses:70Used by:74
Symbol 73 GraphicUsed by:74
Symbol 74 ButtonUses:71 72 73Used by:Timeline
Symbol 75 GraphicUsed by:76 77
Symbol 76 MovieClipUses:75Used by:77
Symbol 77 ButtonUses:76 75Used by:Timeline
Symbol 78 GraphicUsed by:79 80
Symbol 79 MovieClipUses:78Used by:80
Symbol 80 ButtonUses:79 78Used by:Timeline
Symbol 81 GraphicUsed by:82 83 84 107 110 113 114
Symbol 82 MovieClipUses:81Used by:84 107 110 113 114
Symbol 83 MovieClipUses:81Used by:84 107 110 113 114
Symbol 84 ButtonUses:81 82 83Used by:Timeline
Symbol 85 GraphicUsed by:86 88
Symbol 86 MovieClipUses:85Used by:87  Timeline
Symbol 87 MovieClipUses:86Used by:88  Timeline
Symbol 88 ButtonUses:87 85Used by:Timeline
Symbol 89 GraphicUsed by:90 91 102 108 111
Symbol 90 MovieClipUses:89Used by:91 102 108 111
Symbol 91 ButtonUses:90 89Used by:Timeline
Symbol 92 TextUses:20Used by:95
Symbol 93 TextUses:20Used by:95
Symbol 94 GraphicUsed by:95
Symbol 95 ButtonUses:92 93 94Used by:Timeline
Symbol 96 TextUses:20Used by:99
Symbol 97 TextUses:20Used by:99
Symbol 98 GraphicUsed by:99
Symbol 99 ButtonUses:96 97 98Used by:Timeline
Symbol 100 GraphicUsed by:101
Symbol 101 MovieClipUses:100Used by:Timeline
Symbol 102 ButtonUses:90 89Used by:Timeline
Symbol 103 GraphicUsed by:104 105 106 109 112
Symbol 104 MovieClipUses:103Used by:105 106 109 112
Symbol 105 ButtonUses:104 103Used by:Timeline
Symbol 106 ButtonUses:104 103Used by:Timeline
Symbol 107 ButtonUses:81 82 83Used by:Timeline
Symbol 108 ButtonUses:90 89Used by:Timeline
Symbol 109 ButtonUses:104 103Used by:Timeline
Symbol 110 ButtonUses:81 82 83Used by:Timeline
Symbol 111 ButtonUses:90 89Used by:Timeline
Symbol 112 ButtonUses:104 103Used by:Timeline
Symbol 113 ButtonUses:81 82 83Used by:Timeline
Symbol 114 ButtonUses:81 82 83Used by:Timeline
Symbol 115 MovieClipUses:40Used by:193  Timeline
Symbol 116 GraphicUsed by:Timeline
Symbol 117 GraphicUsed by:118
Symbol 118 MovieClipUses:117Used by:Timeline
Symbol 119 EditableTextUses:20Used by:Timeline
Symbol 120 EditableTextUses:20Used by:Timeline
Symbol 121 GraphicUsed by:128
Symbol 122 GraphicUsed by:123 124
Symbol 123 MovieClipUses:122Used by:124
Symbol 124 ButtonUses:123 122Used by:128
Symbol 125 GraphicUsed by:126 127
Symbol 126 MovieClipUses:125Used by:127
Symbol 127 ButtonUses:126 125Used by:128
Symbol 128 MovieClipUses:121 124 127Used by:Timeline
Symbol 129 EditableTextUses:20Used by:Timeline
Symbol 130 TextUses:20Used by:Timeline
Symbol 131 GraphicUsed by:132
Symbol 132 MovieClipUses:131Used by:Timeline
Symbol 133 GraphicUsed by:134
Symbol 134 MovieClipUses:133Used by:Timeline
Symbol 135 GraphicUsed by:136
Symbol 136 MovieClipUses:135Used by:Timeline
Symbol 137 GraphicUsed by:138
Symbol 138 MovieClipUses:137Used by:Timeline
Symbol 139 GraphicUsed by:140
Symbol 140 MovieClipUses:139Used by:Timeline
Symbol 141 GraphicUsed by:142
Symbol 142 MovieClipUses:141Used by:Timeline
Symbol 143 GraphicUsed by:144
Symbol 144 MovieClipUses:143Used by:Timeline
Symbol 145 GraphicUsed by:146
Symbol 146 MovieClipUses:145Used by:Timeline
Symbol 147 GraphicUsed by:148
Symbol 148 MovieClipUses:147Used by:Timeline
Symbol 149 TextUses:20Used by:Timeline
Symbol 150 TextUses:20Used by:Timeline
Symbol 151 GraphicUsed by:152
Symbol 152 MovieClipUses:151Used by:Timeline
Symbol 153 GraphicUsed by:154
Symbol 154 MovieClipUses:153Used by:155
Symbol 155 MovieClipUses:154Used by:Timeline
Symbol 156 GraphicUsed by:157
Symbol 157 MovieClipUses:156Used by:Timeline
Symbol 158 GraphicUsed by:159
Symbol 159 MovieClipUses:158Used by:Timeline
Symbol 160 GraphicUsed by:161
Symbol 161 MovieClipUses:160Used by:Timeline
Symbol 162 GraphicUsed by:163
Symbol 163 MovieClipUses:162Used by:Timeline
Symbol 164 GraphicUsed by:165
Symbol 165 MovieClipUses:164Used by:Timeline
Symbol 166 GraphicUsed by:167 184
Symbol 167 MovieClipUses:166Used by:Timeline
Symbol 168 MovieClipUses:33Used by:Timeline
Symbol 169 GraphicUsed by:170
Symbol 170 MovieClipUses:169Used by:Timeline
Symbol 171 MovieClipUses:35Used by:172
Symbol 172 MovieClipUses:171Used by:173
Symbol 173 MovieClipUses:172Used by:174
Symbol 174 MovieClipUses:173Used by:175
Symbol 175 MovieClipUses:174Used by:177
Symbol 176 MovieClipUses:48Used by:177
Symbol 177 MovieClipUses:175 176Used by:Timeline
Symbol 178 GraphicUsed by:179
Symbol 179 MovieClipUses:178Used by:Timeline
Symbol 180 GraphicUsed by:181
Symbol 181 MovieClipUses:180Used by:Timeline
Symbol 182 GraphicUsed by:183
Symbol 183 MovieClipUses:182Used by:Timeline
Symbol 184 MovieClipUses:166Used by:Timeline
Symbol 185 GraphicUsed by:186
Symbol 186 MovieClipUses:185Used by:187
Symbol 187 MovieClipUses:186Used by:188
Symbol 188 MovieClipUses:187Used by:189
Symbol 189 MovieClipUses:188Used by:Timeline
Symbol 190 SoundUsed by:Timeline
Symbol 191 GraphicUsed by:192
Symbol 192 MovieClipUses:191Used by:Timeline
Symbol 193 MovieClipUses:115Used by:Timeline
Symbol 194 GraphicUsed by:Timeline
Symbol 195 EditableTextUses:20Used by:Timeline
Symbol 196 EditableTextUses:20Used by:Timeline
Symbol 197 EditableTextUses:20Used by:Timeline
Symbol 198 GraphicUsed by:Timeline
Symbol 199 EditableTextUses:20Used by:Timeline
Symbol 200 EditableTextUses:20Used by:Timeline
Symbol 201 EditableTextUses:20Used by:Timeline
Symbol 202 GraphicUsed by:Timeline
Symbol 203 EditableTextUses:20Used by:Timeline
Symbol 204 EditableTextUses:20Used by:Timeline
Symbol 205 EditableTextUses:20Used by:Timeline
Symbol 206 SoundUsed by:Timeline
Symbol 207 EditableTextUses:20Used by:Timeline
Symbol 208 EditableTextUses:20Used by:Timeline
Symbol 209 EditableTextUses:20Used by:Timeline
Symbol 210 GraphicUsed by:Timeline
Symbol 211 EditableTextUses:20Used by:Timeline
Symbol 212 EditableTextUses:20Used by:Timeline
Symbol 213 EditableTextUses:20Used by:Timeline
Symbol 214 GraphicUsed by:Timeline
Symbol 215 EditableTextUses:20Used by:Timeline
Symbol 216 EditableTextUses:20Used by:Timeline
Symbol 217 EditableTextUses:20Used by:Timeline
Symbol 218 SoundUsed by:Timeline
Symbol 219 GraphicUsed by:Timeline
Symbol 220 EditableTextUses:20Used by:Timeline
Symbol 221 EditableTextUses:20Used by:Timeline
Symbol 222 EditableTextUses:20Used by:Timeline
Symbol 223 GraphicUsed by:Timeline
Symbol 224 EditableTextUses:20Used by:Timeline
Symbol 225 EditableTextUses:20Used by:Timeline
Symbol 226 EditableTextUses:20Used by:Timeline
Symbol 227 GraphicUsed by:Timeline
Symbol 228 EditableTextUses:20Used by:Timeline
Symbol 229 EditableTextUses:20Used by:Timeline
Symbol 230 EditableTextUses:20Used by:Timeline
Symbol 231 GraphicUsed by:Timeline
Symbol 232 EditableTextUses:20Used by:Timeline
Symbol 233 EditableTextUses:20Used by:Timeline
Symbol 234 EditableTextUses:20Used by:Timeline
Symbol 235 GraphicUsed by:Timeline
Symbol 236 EditableTextUses:20Used by:Timeline
Symbol 237 EditableTextUses:20Used by:Timeline
Symbol 238 EditableTextUses:20Used by:Timeline
Symbol 239 GraphicUsed by:240
Symbol 240 MovieClipUses:239Used by:Timeline
Symbol 241 GraphicUsed by:Timeline
Symbol 242 GraphicUsed by:243
Symbol 243 MovieClipUses:242Used by:Timeline
Symbol 244 TextUses:70Used by:Timeline
Symbol 245 TextUses:20Used by:Timeline
Symbol 246 TextUses:20Used by:Timeline
Symbol 247 TextUses:20Used by:Timeline
Symbol 248 TextUses:20Used by:Timeline
Symbol 249 TextUses:20Used by:Timeline
Symbol 250 TextUses:20Used by:Timeline
Symbol 251 TextUses:20Used by:Timeline
Symbol 252 TextUses:20Used by:Timeline
Symbol 253 TextUses:20Used by:Timeline
Symbol 254 TextUses:20Used by:Timeline
Symbol 255 TextUses:20Used by:Timeline
Symbol 256 TextUses:20Used by:Timeline
Symbol 257 TextUses:20Used by:Timeline
Symbol 258 TextUses:20Used by:Timeline
Symbol 259 TextUses:20Used by:Timeline
Symbol 260 TextUses:20Used by:263
Symbol 261 TextUses:20Used by:263
Symbol 262 GraphicUsed by:263
Symbol 263 ButtonUses:260 261 262Used by:Timeline
Symbol 264 TextUses:20Used by:267
Symbol 265 TextUses:20Used by:267
Symbol 266 GraphicUsed by:267
Symbol 267 ButtonUses:264 265 266Used by:Timeline
Symbol 268 TextUses:70Used by:Timeline
Symbol 269 TextUses:20Used by:Timeline

Instance Names

"popup"Frame 9Symbol 128 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 119 EditableText""
linesSymbol 120 EditableText""
levelSymbol 129 EditableText""
scoreSymbol 195 EditableText""
linesSymbol 196 EditableText""
levelSymbol 197 EditableText""
scoreSymbol 199 EditableText""
linesSymbol 200 EditableText""
levelSymbol 201 EditableText""
scoreSymbol 203 EditableText""
linesSymbol 204 EditableText""
levelSymbol 205 EditableText""
scoreSymbol 207 EditableText""
linesSymbol 208 EditableText""
levelSymbol 209 EditableText""
scoreSymbol 211 EditableText""
linesSymbol 212 EditableText""
levelSymbol 213 EditableText""
scoreSymbol 215 EditableText""
linesSymbol 216 EditableText""
levelSymbol 217 EditableText""
scoreSymbol 220 EditableText""
linesSymbol 221 EditableText""
levelSymbol 222 EditableText""
scoreSymbol 224 EditableText""
linesSymbol 225 EditableText""
levelSymbol 226 EditableText""
scoreSymbol 228 EditableText""
linesSymbol 229 EditableText""
levelSymbol 230 EditableText""
scoreSymbol 232 EditableText""
linesSymbol 233 EditableText""
levelSymbol 234 EditableText""
scoreSymbol 236 EditableText""
linesSymbol 237 EditableText""
levelSymbol 238 EditableText""




http://swfchan.com/15/71237/info.shtml
Created: 9/4 -2019 11:15:53 Last modified: 9/4 -2019 11:15:53 Server time: 17/05 -2024 10:38:37