Frame 1
stop();
Frame 2
function randomizeShapes() {
game.totalShapes = 1;
game.pieces = [];
var i = 0;
while (i < game.totalColumns) {
if (typeof(game.pieces[i].toString()) == "undefined") {
game.pieces[i] = [];
}
var j = 0;
while (j < game.totalRows) {
var topShape = (random(game.totalShapes) + 1);
var bottomShape = (random(game.totalShapes) + 1);
var leftShape = (random(game.totalShapes) + 1);
var rightShape = (random(game.totalShapes) + 1);
var rightSolid = (random(2) ? true : false);
var bottomSolid = (random(2) ? true : false);
if (i == 0) {
var leftShape = 0;
} else if (i == (game.totalColumns - 1)) {
var rightShape = 0;
var leftShape = game.pieces[i - 1][j].rightShape;
var leftSolid = (game.pieces[i - 1][j].rightSolid ? false : true);
} else {
var leftShape = game.pieces[i - 1][j].rightShape;
var leftSolid = (game.pieces[i - 1][j].rightSolid ? false : true);
}
if (j == 0) {
var topShape = 0;
} else if (j == (game.totalRows - 1)) {
var bottomShape = 0;
var topShape = game.pieces[i][j - 1].bottomShape;
var topSolid = (game.pieces[i][j - 1].bottomSolid ? false : true);
} else {
var topShape = game.pieces[i][j - 1].bottomShape;
var topSolid = (game.pieces[i][j - 1].bottomSolid ? false : true);
}
game.pieces[i][j] = {leftShape:leftShape, leftSolid:leftSolid, rightShape:rightShape, rightSolid:rightSolid, topShape:topShape, topSolid:topSolid, bottomShape:bottomShape, bottomSolid:bottomSolid};
j++;
}
i++;
}
}
function buildBoard() {
_root.createEmptyMovieClip("board", 1);
game = {};
game.path = _root.board;
game.scale = scale;
game.path.depth = 100;
game.imageHeight = 396;
game.imageWidth = 550;
game.pieceWidth = 100 * game.scale;
game.pieceHeight = 60 * game.scale;
game.totalColumns = Math.floor(game.imageWidth / game.pieceWidth);
game.totalRows = Math.floor(game.imageHeight / game.pieceHeight);
randomizeShapes();
pieces = new Array();
var i = 0;
while (i < game.totalColumns) {
var j = 0;
while (j < game.totalRows) {
var name = ((("piece" + i) + "_") + j);
game.path.attachMovie("piece", name, ++game.path.depth);
var clip = game.path[name];
var ob = game.pieces[i][j];
clip.mask._x = i * game.pieceWidth;
clip.mask2._x = i * game.pieceWidth;
clip.mask._y = j * game.pieceHeight;
clip.mask2._y = j * game.pieceHeight;
clip._alpha = 90;
var leftFrame = ((ob.leftShape * 2) + (ob.leftSolid ? 2 : 1));
clip.mask.left.gotoAndStop(leftFrame);
clip.mask2.left_bevel.gotoAndStop(leftFrame);
var rightFrame = ((ob.rightShape * 2) + (ob.rightSolid ? 2 : 1));
clip.mask.right.gotoAndStop(rightFrame);
clip.mask2.right_bevel.gotoAndStop(rightFrame);
var topFrame = ((ob.topShape * 2) + (ob.topSolid ? 2 : 1));
clip.mask.top.gotoAndStop(topFrame);
clip.mask2.top_bevel.gotoAndStop(topFrame);
var bottomFrame = ((ob.bottomShape * 2) + (ob.bottomSolid ? 2 : 1));
clip.mask.bottom.gotoAndStop(bottomFrame);
clip.mask2.bottom_bevel.gotoAndStop(bottomFrame);
clip.mask._xscale = game.scale * 100;
clip.mask2._xscale = game.scale * 100;
clip.mask._yscale = game.scale * 100;
clip.mask2._yscale = game.scale * 100;
clip.image.setMask(clip.mask);
clip.column = i;
clip.row = j;
clip.onPress = function () {
this.follow = true;
this.xOffset = (_root.board._xmouse - ((this.column * _root.game.pieceWidth) * _root.game.scale)) - this._x;
this.yOffset = (_root.board._ymouse - ((this.row * _root.game.pieceHeight) * _root.game.scale)) - this._y;
};
clip.onMouseMove = function () {
if (this.follow) {
updateAfterEvent();
this._x = (_root.board._xmouse - ((this.column * _root.game.pieceWidth) * _root.game.scale)) - this.xOffset;
this._y = (_root.board._ymouse - ((this.row * _root.game.pieceHeight) * _root.game.scale)) - this.yOffset;
}
};
clip.onMouseUp = function () {
this.follow = false;
alignPiece();
};
pieces.push(clip);
j++;
}
i++;
}
board._xscale = (board._yscale = 80);
board._x = 350 - (board._width / 2);
board._y = 225 - (board._height / 2);
}
function messUpBoard() {
board.piece0_0._x = board.piece0_0._x + 555;
board.piece0_0._y = board.piece0_0._y + 85;
board.piece1_0._x = board.piece1_0._x + 200;
board.piece1_0._y = board.piece1_0._y - 45;
board.piece2_0._x = board.piece2_0._x + 5;
board.piece2_0._y = board.piece2_0._y + 370;
board.piece3_0._x = board.piece3_0._x - 240;
board.piece3_0._y = board.piece3_0._y + 403;
board.piece4_0._x = board.piece4_0._x + 40;
board.piece4_0._y = board.piece4_0._y + 305;
board.piece0_1._x = board.piece0_1._x + -90;
board.piece0_1._y = board.piece0_1._y + 0;
board.piece1_1._x = board.piece1_1._x + -120;
board.piece1_1._y = board.piece1_1._y + -120;
board.piece2_1._x = board.piece2_1._x + 200;
board.piece2_1._y = board.piece2_1._y + -135;
board.piece3_1._x = board.piece3_1._x + -30;
board.piece3_1._y = board.piece3_1._y + 300;
board.piece4_1._x = board.piece4_1._x + -435;
board.piece4_1._y = board.piece4_1._y + 295;
board.piece0_2._x = board.piece0_2._x + 380;
board.piece0_2._y = board.piece0_2._y + 255;
board.piece1_2._x = board.piece1_2._x + 80;
board.piece1_2._y = board.piece1_2._y + -200;
board.piece2_2._x = board.piece2_2._x + -355;
board.piece2_2._y = board.piece2_2._y + -15;
board.piece3_2._x = board.piece3_2._x + 162;
board.piece3_2._y = board.piece3_2._y + -100;
board.piece4_2._x = board.piece4_2._x + 114;
board.piece4_2._y = board.piece4_2._y + 262;
board.piece0_3._x = board.piece0_3._x + 525;
board.piece0_3._y = board.piece0_3._y + -20;
board.piece1_3._x = board.piece1_3._x + -178;
board.piece1_3._y = board.piece1_3._y + 200;
board.piece2_3._x = board.piece2_3._x + -310;
board.piece2_3._y = board.piece2_3._y + 0;
board.piece3_3._x = board.piece3_3._x + 200;
board.piece3_3._y = board.piece3_3._y + -240;
board.piece4_3._x = board.piece4_3._x - 500;
board.piece4_3._y = board.piece4_3._y + -220;
board.piece0_4._x = board.piece0_4._x + 550;
board.piece0_4._y = board.piece0_4._y + 45;
board.piece1_4._x = board.piece1_4._x + 480;
board.piece1_4._y = board.piece1_4._y + -230;
board.piece2_4._x = board.piece2_4._x + -100;
board.piece2_4._y = board.piece2_4._y + -300;
board.piece3_4._x = board.piece3_4._x + -220;
board.piece3_4._y = board.piece3_4._y + 100;
board.piece4_4._x = board.piece4_4._x - 545;
board.piece4_4._y = board.piece4_4._y + 0;
board.piece0_5._x = board.piece0_5._x + -130;
board.piece0_5._y = board.piece0_5._y + 25;
board.piece1_5._x = board.piece1_5._x + -250;
board.piece1_5._y = board.piece1_5._y + -300;
board.piece2_5._x = board.piece2_5._x + 138;
board.piece2_5._y = board.piece2_5._y + 110;
board.piece3_5._x = board.piece3_5._x + 280;
board.piece3_5._y = board.piece3_5._y + 45;
board.piece4_5._x = board.piece4_5._x + 135;
board.piece4_5._y = board.piece4_5._y + -90;
}
function alignPiece() {
completed = true;
var i = 0;
while (i < 5) {
var j = 0;
while (j < 6) {
thisPiece = (("piece" + i) + "_") + j;
clip = game.path[thisPiece];
if ((((clip._x > -10) && (clip._x < 10)) && (clip._y < 10)) && (clip._y > -10)) {
clip._alpha = 100;
clip._x = 0;
clip._y = 0;
} else {
clip._alpha = 90;
completed = false;
}
j++;
}
i++;
}
if (completed) {
finished();
}
}
function finished() {
var i = 0;
while (i < 5) {
var j = 0;
while (j < 6) {
thisPiece = (("piece" + i) + "_") + j;
clip = game.path[thisPiece];
clip.removeMovieClip();
j++;
}
i++;
}
gotoAndStop (4);
}
function placePiece() {
placed = false;
while (!placed) {
startPiece = Math.floor(Math.random() * 30);
placedPiece = pieces[startPiece];
if (placedPiece._alpha != 100) {
placedPiece._x = 0;
placedPiece._y = 0;
placedPiece._alpha = 100;
placed = true;
}
}
alignPiece();
}
function placePieces() {
while (allPlaced == false) {
if (getTimer() >= (oldTime + 300)) {
placePiece();
oldTime = getTimer();
}
}
}
scale = 1;
buildBoard();
messUpBoard();
allPlaced = false;
oldTime = getTimer();
_root.createEmptyMovieClip("myframe", 998);
myframe.attachMovie("frame", frame, 998);
myframe._x = 328;
myframe._y = 211;
_root.createEmptyMovieClip("mymenu", 999);
mymenu.attachMovie("menu", menu, 999);
mymenu._x = 3000;
mymenu._y = 211;
stop();
Instance of Symbol 31 MovieClip in Frame 2
onClipEvent (enterFrame) {
if ((((_root.board.piece0_0._x > -10) && (_root.board.piece0_0._x < 10)) && (_root.board.piece0_0._y < 10)) && (_root.board.piece0_0._y > -10)) {
_root.board.piece0_0._alpha = 100;
}
}
Frame 3
allPlaced = true;
stop();
Frame 4
stop();
Symbol 10 Button
on (release) {
_root.mymenu._x = 3000;
}
Symbol 16 Button
on (release) {
nextFrame();
}
Symbol 18 Button
on (release) {
getURL ("http://www.kwikgames.com", _blank);
}
Symbol 20 Button
on (release) {
getURL ("http://www.kernowweb.co.uk", _blank);
}
Symbol 27 Button
on (release) {
nextFrame();
}
Symbol 38 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 1
stop();
Symbol 46 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 1
stop();
Symbol 52 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 1
stop();
Symbol 62 Button
on (release) {
mymenu._x = 328;
}
Symbol 68 Button
on (release) {
getURL ("http://www.kernowweb.co.uk", _blank);
}
Symbol 72 Button
on (release) {
placePiece();
}
Symbol 76 Button
on (release) {
getURL ("http://www.kwikgames.com", _blank);
}
Symbol 78 MovieClip Frame 20
stop();
Symbol 84 Button
on (press) {
gotoAndStop (2);
}
Symbol 89 Button
on (release) {
getURL ("http://www.kwikgames.com", _blank);
}