Frame 4
tb = getBytesTotal();
lb = getBytesLoaded();
v = int((lb / tb) * 100);
_preloader.bar._xscale = v;
_preloader._pretxtPercent.text = v + "%";
if (lb < tb) {
gotoAndPlay(_currentframe - 1);
} else {
play();
}
Frame 36
sound_sound = new Sound();
sound_sound.attachSound("sound");
stop();
Frame 38
var vlevel = 1;
Frame 42
function moveCursor(dx, dy) {
var _local1 = dy;
var _local2 = dx;
newx = game.cursor.x + _local2;
newy = game.cursor.y + _local1;
if (((newx < 0) || (newx > game.cursor.maxpos)) || ((newy < 0) || (newy > game.cursor.maxpos))) {
} else {
game.cursor._x = game.cursor._x + (_local2 * digitwidth);
game.cursor._y = game.cursor._y + (_local1 * digitwidth);
game.cursor.x = game.cursor.x + _local2;
game.cursor.y = game.cursor.y + _local1;
game.cursor.pos = getPos(game.cursor.x, game.cursor.y);
}
}
function setCursorRandom() {
game.cursor.x = random((rows - cursorrows) + 1);
game.cursor.y = random((rows - cursorrows) + 1);
game.cursor._x = game.cursor.x * digitwidth;
game.cursor._y = game.cursor.y * digitwidth;
game.cursor.pos = getPos(game.cursor.x, game.cursor.y);
}
function rotate(dir) {
x = game.cursor.x;
y = game.cursor.y;
if (cursorrows == 3) {
if (dir == 0) {
n = findAtPos(getPos(x, y));
setNewPos(game["digit" + n], 1, 0);
n = findAtPos(getPos(x + 1, y));
setNewPos(game["digit" + n], 1, 0);
n = findAtPos(getPos(x + 2, y));
setNewPos(game["digit" + n], 0, 1);
n = findAtPos(getPos(x + 2, y + 1));
setNewPos(game["digit" + n], 0, 1);
n = findAtPos(getPos(x + 2, y + 2));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x + 1, y + 2));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x, y + 2));
setNewPos(game["digit" + n], 0, -1);
n = findAtPos(getPos(x, y + 1));
setNewPos(game["digit" + n], 0, -1);
} else {
n = findAtPos(getPos(x, y));
setNewPos(game["digit" + n], 0, 1);
n = findAtPos(getPos(x + 1, y));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x + 2, y));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x + 2, y + 1));
setNewPos(game["digit" + n], 0, -1);
n = findAtPos(getPos(x + 2, y + 2));
setNewPos(game["digit" + n], 0, -1);
n = findAtPos(getPos(x + 1, y + 2));
setNewPos(game["digit" + n], 1, 0);
n = findAtPos(getPos(x, y + 2));
setNewPos(game["digit" + n], 1, 0);
n = findAtPos(getPos(x, y + 1));
setNewPos(game["digit" + n], 0, 1);
}
} else if (dir == 0) {
n = findAtPos(getPos(x, y));
setNewPos(game["digit" + n], 1, 0);
n = findAtPos(getPos(x + 1, y));
setNewPos(game["digit" + n], 0, 1);
n = findAtPos(getPos(x + 1, y + 1));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x, y + 1));
setNewPos(game["digit" + n], 0, -1);
} else {
n = findAtPos(getPos(x, y));
setNewPos(game["digit" + n], 0, 1);
n = findAtPos(getPos(x + 1, y));
setNewPos(game["digit" + n], -1, 0);
n = findAtPos(getPos(x + 1, y + 1));
setNewPos(game["digit" + n], 0, -1);
n = findAtPos(getPos(x, y + 1));
setNewPos(game["digit" + n], 1, 0);
}
sound_sound.start();
gameOn = false;
}
function getPos(x, y) {
return((y * rows) + x);
}
function setNewPos(dig, x, y) {
var _local1 = dig;
_local1.npos = getNewPos(_local1.pos, x, y);
_local1.nx = _local1._x + (x * digitwidth);
_local1.ny = _local1._y + (y * digitwidth);
_local1.dx = (_local1.nx - _local1._x) / 10;
_local1.dy = (_local1.ny - _local1._y) / 10;
_local1.moving = true;
}
function getNewPos(p, x2, y2) {
return((p + (y2 * rows)) + x2);
}
function findAtPos(pos) {
var _local2 = pos;
var _local1 = 0;
while (_local1 < totaldigits) {
digit = game["digit" + _local1];
if (digit.pos == _local2) {
return(_local1);
}
_local1++;
}
return(undefined);
}
function goNextLevel() {
removeMovieClip(game);
vlevel++;
gotoAndPlay (39);
}
function shuffle() {
if (changes > 0) {
setCursorRandom();
rotate(random(2));
} else {
gameOn2 = false;
gameOn = true;
}
}
var gameOn = false;
var gameOn2 = false;
var gameOver = false;
var boardwidth = 300;
won._visible = false;
level_mc.text = "Level: " + vlevel;
switch (vlevel) {
case 1 :
var rows = 3;
var cursorrows = 2;
var changes = 5;
break;
case 2 :
var rows = 4;
var cursorrows = 2;
var changes = 6;
break;
case 3 :
var rows = 5;
var cursorrows = 2;
var changes = 5;
break;
case 4 :
var rows = 6;
var cursorrows = 2;
var changes = 6;
break;
case 5 :
var rows = 4;
var cursorrows = 3;
var changes = 7;
break;
case 6 :
var rows = 5;
var cursorrows = 3;
var changes = 8;
break;
case 7 :
var rows = 6;
var cursorrows = 3;
var changes = 9;
break;
default :
var rows = 7;
var cursorrows = 3;
var changes = 10;
}
var digitwidth = (boardwidth / rows);
var totaldigits = (rows * rows);
var game = attachMovie("game", "game", 100);
game._x = 50;
game._y = 30;
game._visible = true;
var dx = 0;
var dy = 0;
var i = 0;
while (i < totaldigits) {
newdigit = game.attachMovie("digit", "digit" + i, 1000 + i);
newdigit.numb = i + 1;
newdigit.num = i;
newdigit.pos = i;
newdigit.moving = false;
newdigit._visible = true;
newdigit._x = dx * digitwidth;
newdigit._y = dy * digitwidth;
newdigit._width = digitwidth;
newdigit._height = digitwidth;
dx++;
if (dx == rows) {
dx = 0;
dy++;
}
i++;
}
cursor = game.attachMovie("cursor", "cursor", i + 1000);
cursor.x = 0;
cursor.y = 0;
cursor.maxpos = rows - cursorrows;
cursor.pos = 1;
cursor._x = 0;
cursor._y = 0;
cursor._visible = true;
cursor._height = digitwidth * cursorrows;
cursor._width = digitwidth * cursorrows;
gameOn2 = true;
shuffle();
stop();
Instance of Symbol 98 MovieClip in Frame 42
onClipEvent (enterFrame) {
if ((_parent.gameOn == false) && (_parent.gameOver == false)) {
var flag = false;
var i = 0;
while (i < _parent.totaldigits) {
digit = _parent.game["digit" + i];
if (digit.moving == true) {
flag = true;
digit._x = digit._x + digit.dx;
digit._y = digit._y + digit.dy;
if ((Math.abs(digit.nx - digit._x) < 1) && (Math.abs(digit.ny - digit._y) < 1)) {
digit._x = digit.nx;
digit._y = digit.ny;
digit.moving = false;
digit.pos = digit.npos;
}
}
i++;
}
if (flag == false) {
if (_parent.gameOn2 == false) {
_parent.gameOn = true;
var flagwin = true;
var i = 0;
while (i < _parent.totaldigits) {
digit = _parent.game["digit" + i];
if (digit.pos != digit.num) {
flagwin = false;
}
i++;
}
if (flagwin == true) {
_parent.won._visible = true;
_parent.gameOn = false;
_parent.gameOver = true;
}
} else {
_parent.changes--;
_parent.shuffle();
}
}
}
}
Symbol 24 MovieClip Frame 1
_parent.stop();
Symbol 24 MovieClip Frame 166
stop();
_parent.play();
Symbol 30 Button
on (release) {
getURL ("http://www.urgames.com", "_self");
}
Symbol 34 Button
on (release) {
getURL ("http://www.gamesforyourwebsite.com", "_self");
}
Symbol 38 Button
on (release) {
getURL ("http://www.urgames.com/forums", "_self");
}
Symbol 42 Button
on (release) {
getURL ("http://www.urgames.com/cheats", "_self");
}
Symbol 65 Button
on (release) {
gotoAndPlay (38);
}
Symbol 69 Button
on (release) {
gotoAndStop (37);
}
Symbol 77 Button
on (release) {
gotoAndStop ("creditframe");
}
Symbol 85 Button
on (release) {
gotoAndStop (36);
}
Symbol 90 Button
on (release) {
_parent.goNextLevel();
}
Symbol 96 Button
on (keyPress "z") {
if (gameOn == true) {
rotate(0);
}
}
on (keyPress "Z") {
if (gameOn == true) {
rotate(0);
}
}
on (keyPress "x") {
if (gameOn == true) {
rotate(1);
}
}
on (keyPress "X") {
if (gameOn == true) {
rotate(1);
}
}
on (keyPress "<Left>") {
if (gameOn == true) {
moveCursor(-1, 0);
}
}
on (keyPress "<Right>") {
if (gameOn == true) {
moveCursor(1, 0);
}
}
on (keyPress "<Up>") {
if (gameOn == true) {
moveCursor(0, -1);
}
}
on (keyPress "<Down>") {
if (gameOn == true) {
moveCursor(0, 1);
}
}
Symbol 102 Button
on (release) {
removeMovieClip("game");
gotoAndStop (36);
}
Symbol 107 Button
on (release) {
getURL ("http://www.quickflashgames.com/", "_blank");
}