Frame 1
Frame 3
fscommand ("fullscreen", "true");
Frame 4
function playgame() {
gotoAndPlay (145);
}
function resetplayerstage() {
gotoAndPlay (65);
}
function gohottoplay() {
gotoAndPlay (150);
}
function go_mainmenu() {
gotoAndPlay (4);
}
storage = SharedObject.getLocal("match");
_root.playerstage = storage.data.playerstage;
_root.beatengame = storage.data.beatengame;
_root.currentscore = storage.data.currentscore;
_root.highscore = storage.data.highscore;
if (_root.highscore == undefined) {
storage.data.highscore = 0;
_root.highscore = 0;
}
if (playerstage == undefined) {
storage.data.playerstage = 1;
_root.playerstage = 1;
}
if (beatengame == undefined) {
storage.data.beatengame = 0;
}
if ((_root.currentscore == 0) || (_root.currentscore == undefined)) {
_root.currentscore = 0;
storage.data.currentscore = 0;
}
trace(_root.beatengame);
trace("hmmm");
if (playerstage > 20) {
playerstage = 1;
}
if (playerstage > 1) {
this.mainbuttons.gotoAndPlay("continue");
}
_root.uptostage = "you are up to stage " + playerstage;
_root.playonfrom = (("play on from stage " + playerstage) + " with a score of ") + _root.currentscore;
_root.beatengamereport = "";
trace("beatengame=" + beatengame);
if (beatengame == 1) {
_root.beatengamereport = "You have beaten this game once";
}
if (beatengame > 1) {
_root.beatengamereport = ("You have beaten this game " + beatengame) + " times";
}
if ((beatengame == undefined) || (beatengame == 0)) {
_root.beatengamereport = "You not beaten this game yet";
}
if (highscore > 0) {
_root.beatengamereport = _root.beatengamereport + (" & your highest score is " + highscore);
}
_root.score = _root.currentscore;
Frame 64
stop();
Frame 65
function press_yes() {
storage.data.playerstage = 1;
playerstage = 1;
currentscore = 0;
storage.data.currentscore = 0;
gotoAndPlay ("stagereset");
}
function press_no() {
gotoAndPlay (4);
}
Frame 90
stop();
Frame 144
gotoAndPlay (4);
Frame 145
Array.prototype.randomize = function () {
return(this.sort(function (a, b) {
return(((Math.floor(Math.random() * 2) == 0) ? 1 : -1));
}));
};
myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
function setupsounds() {
var _local1 = _global;
_local1.timewarning_snd = new Sound();
timewarning_snd.attachSound("Time warning sound");
_local1.presscard_snd = new Sound();
presscard_snd.attachSound("press card sound");
_local1.matchmade_snd = new Sound();
matchmade_snd.attachSound("match made sound");
_local1.matchmade_snd = new Sound();
matchmade_snd.attachSound("match made sound");
_local1.levelcomplete_snd = new Sound();
levelcomplete_snd.attachSound("level complete sound");
_local1.missmatch_snd = new Sound();
missmatch_snd.attachSound("miss match");
}
function pressacard(cardn) {
if (firstcardpressed == 0) {
firstcardpressed = 1;
start_time = getTimer();
}
if (action == "nothing") {
if (cardspressed < 2) {
flips++;
presscard_snd.start();
cardspressed++;
switch (cardspressed) {
case 1 :
card1 = carddata[cardn];
card1cardn = cardn;
eval ("c" + cardn).gotoAndPlay(1);
return;
case 2 :
card2 = carddata[cardn];
card2cardn = cardn;
if (card1 != card2) {
cardspressed = 0;
action = "no match delay";
counter = 20;
missmatch_snd.start();
} else {
action = "match made delay";
matchmade_snd.start();
this.timer.gotoAndPlay("bonustime");
start_time = start_time + bonus_time;
counter = 20;
}
eval ("c" + cardn).gotoAndPlay(1);
}
}
}
}
function initcards() {
level1 = new Array(1, 1, 2, 2, 3, 3, 4, 4);
level1time = 30;
level2 = new Array(1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 0, 0, 0);
level2time = 25;
level3 = new Array(1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2, 0, 0, 0, 0);
level3time = 25;
level4 = new Array(1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2, 5, 5);
level4time = 25;
level5 = new Array(2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 0, 0);
level5time = 20;
level6 = new Array(0, 0, 0, 26, 26, 13, 13, 26, 26, 13, 13, 26, 26, 13, 13, 26, 26, 13, 13, 26, 26, 13, 13);
level6time = 20;
level7 = new Array(0, 0, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11);
level7time = 20;
level8 = new Array(0, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 6, 6);
level8time = 20;
level9 = new Array(0, 0, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 7, 7);
level9time = 20;
level10 = new Array(7, 7, 8, 8, 9, 9, 11, 11, 11, 11, 12, 12, 12, 12, 7, 7);
level10time = 15;
level11 = new Array(0, 0, 0, 0, 1, 1, 1, 1, 7, 7, 7, 7, 11, 11, 11, 11);
level11time = 20;
level12 = new Array(19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21);
level12time = 20;
level13 = new Array(22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25);
level13time = 25;
level14 = new Array(13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 1, 1, 0, 0, 0, 2, 2);
level14time = 20;
level15 = new Array(13, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 18);
level15time = 25;
level16 = new Array(8, 8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 19);
level16time = 25;
level17 = new Array(23, 23, 22, 22, 21, 21, 20, 20, 20, 20, 21, 21, 20, 20, 20, 20, 10, 10, 0);
level17time = 25;
level18 = new Array(25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 20, 20, 21, 21, 0, 0, 0, 0, 0, 0, 0);
level18time = 25;
level19 = new Array(27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 0, 0, 16, 16, 16, 16);
level19time = 25;
level20 = new Array(27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16);
level20time = 25;
_root.limit_time = eval (("level" + playerstage) + "time");
_root.remaining_time = limit_time;
carddata = eval ("level" + playerstage).randomize();
amountofcards = carddata.length;
playablecards = 0;
i = 0;
while (i < carddata.length) {
if (carddata[i] > 0) {
playablecards++;
}
i++;
}
table_columns = Math.ceil(Math.sqrt(amountofcards + 8));
table_rows = Math.ceil(amountofcards / table_columns);
trace("table_rows = " + table_rows);
trace("table_columns = " + table_columns);
cardt = 0;
tempi = 280 - ((table_columns * 75) / 2);
tempj = 280 - ((table_rows / 2) * 110);
trace(tempj);
i = 0;
while (i < table_columns) {
j = 0;
while (j < table_columns) {
if (cardt < amountofcards) {
cname = "c" + cardt;
if (carddata[cardt] > 0) {
attachMovie("card", cname, cardt);
eval (cname).cnum = carddata[cardt];
eval (cname).cardnumber = cardt;
eval (cname).x = tempi + (j * 75);
eval (cname).y = (i * 110) + tempj;
eval (cname)._x = -60;
eval (cname)._y = random(400);
}
cardt++;
}
j++;
}
i++;
}
}
function setup() {
counter = -1;
cardt = 0;
cardpressarray = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
cardspressed = 0;
cards_removed = 0;
bonus_time = 3000;
setupsounds();
_root.flips = 0;
firstcardpressed = 0;
}
function go_playagain() {
this.tellplayer.gotoAndStop(1);
var score:Number = 0;
gotoAndPlay (145);
}
function end_movecardsin() {
cardspeed = 0.95;
m = 0;
i = 0;
while (i < amountofcards) {
c = "c" + i;
tx = eval (c)._x;
ty = eval (c)._y;
x = eval (c).x;
y = eval (c).y;
tempmovex = (tx - x) * cardspeed;
tempmovey = (ty - y) * cardspeed;
if ((Math.abs(tempmovex) < 1) && (Math.abs(tempmovey) < 1)) {
tempmovex = 0;
tempmovey = 0;
}
eval (c)._x = Math.floor(x + tempmovex);
eval (c)._y = Math.floor(y + tempmovey);
if (eval (c)._x == tx) {
m++;
if (m >= amountofcards) {
action = "gameover wait";
cardspressed = 0;
i = 0;
while (i < amountofcards) {
c = "c" + i;
eval (c)._x = eval (c).x;
eval (c)._y = eval (c).y;
i++;
}
}
}
i++;
}
}
function movematchedcards() {
cardspeed = 0.25;
m = 0;
tx = eval ("c" + card1cardn)._x;
ty = eval ("c" + card1cardn)._y;
x = eval ("c" + card1cardn).x;
y = eval ("c" + card1cardn).y;
tempmovex = (tx - x) * cardspeed;
tempmovey = (ty - y) * cardspeed;
if ((Math.abs(tempmovex) < 1) && (Math.abs(tempmovey) < 1)) {
tempmovex = 0;
tempmovey = 0;
}
eval ("c" + card1cardn)._x = Math.floor(x + tempmovex);
eval ("c" + card1cardn)._y = Math.floor(y + tempmovey);
tx = eval ("c" + card2cardn)._x;
ty = eval ("c" + card2cardn)._y;
x = eval ("c" + card2cardn).x;
y = eval ("c" + card2cardn).y;
tempmovex = (tx - x) * cardspeed;
tempmovey = (ty - y) * cardspeed;
if ((Math.abs(tempmovex) < 1) && (Math.abs(tempmovey) < 1)) {
tempmovex = 0;
tempmovey = 0;
}
eval ("c" + card2cardn)._x = Math.floor(x + tempmovex);
eval ("c" + card2cardn)._y = Math.floor(y + tempmovey);
a = Math.abs(Math.floor(x + tempmovex) - tx);
if (a < 2) {
action = "nothing";
cardspressed = 0;
eval ("c" + card1cardn)._x = eval ("c" + card1cardn).x;
eval ("c" + card1cardn)._y = eval ("c" + card1cardn).y;
eval ("c" + card2cardn)._x = eval ("c" + card2cardn).x;
eval ("c" + card2cardn)._y = eval ("c" + card2cardn).y;
}
}
function movecardsin() {
cardspeed = 0.5;
m = 0;
i = 0;
while (i < amountofcards) {
c = "c" + i;
tx = eval (c)._x;
ty = eval (c)._y;
x = eval (c).x;
y = eval (c).y;
if (Math.abs(tx - x) > 0) {
tempmovex = (tx - x) * cardspeed;
} else {
tempmovex = 0;
}
if (Math.abs(ty - y) > 0) {
tempmovey = (ty - y) * cardspeed;
} else {
tempmovey = 0;
}
if ((Math.abs(tempmovex) < 1) && (Math.abs(tempmovey) < 1)) {
tempmovex = 0;
tempmovey = 0;
}
eval (c)._x = Math.floor(x + tempmovex);
eval (c)._y = Math.floor(y + tempmovey);
if (eval (c)._x == tx) {
m++;
if (m >= amountofcards) {
if (action == "gameover move cards") {
action = "gameover wait";
} else {
action = "nothing";
}
cardspressed = 0;
i = 0;
while (i < amountofcards) {
c = "c" + i;
eval (c)._x = eval (c).x;
eval (c)._y = eval (c).y;
i++;
}
}
}
i++;
}
}
function frameaction() {
if (firstcardpressed > 0) {
if ((((action == "move cards in") || (action == "nothing")) || (action == "match made delay")) || (action == "no match delay")) {
now_time = getTimer();
if (last_time == undefined) {
last_time = now_time;
}
if ((now_time - last_time) > 999) {
_root.remaining_time = Math.ceil(limit_time - ((now_time - start_time) / 1000));
if (_root.remaining_time < 10) {
this.timer.gotoAndPlay("timewarning");
last_time = now_time;
}
if (_root.remaining_time < 1) {
action = "time up";
}
}
}
}
switch (action) {
case "game completed" :
_root.currentscore = 0;
storage.data.currentscore = currentscore;
if (score > highscore) {
_root.highscore = score;
storage.data.highscore = _root.highscore;
}
_root.beatengame++;
trace(beatengame);
storage.data.beatengame = _root.beatengame;
i = 0;
while (i < 40) {
removeMovieClip(eval ("c" + i));
i++;
}
this.tellplayer.gotoAndStop("youwin");
action = "game completed wait";
return;
case "game completed wait" :
return;
case "time up" :
currentscore = score;
storage.data.currentscore = currentscore;
if (score > highscore) {
_root.highscore = score;
storage.data.highscore = _root.highscore;
}
i = 0;
while (i < 40) {
cname = "c" + i;
eval (cname).x = random(500);
eval (cname).y = 550;
i++;
}
action = "gameover move cards";
_root.youreached = "You reached stage " + playerstage;
this.tellplayer.gotoAndPlay("gameover");
return;
case "gameover move cards" :
end_movecardsin();
return;
case "gameover wait" :
i = 0;
while (i < 40) {
cname = "c" + i;
removeMovieClip(eval (cname));
i++;
}
return;
case "level complete" :
_root.bonus = 0;
_root.time_points = _root.remaining_time * 10;
_root._root.timereport = _root.remaining_time + " Seconds left x 10";
_root.bonus = _root.bonus + time_points;
_root.flip_points = 1000 - (flips * 25);
if (flip_points < 0) {
flip_points = 0;
}
score = score + (_root.bonus + _root.flip_points);
this.tellplayer.gotoAndPlay(2);
currentscore = score;
storage.data.currentscore = score;
action = "wait for next level";
return;
case "wait for next level" :
return;
case "next stage" :
this.tellplayer.gotoAndStop(1);
i = 0;
while (i < 40) {
removeMovieClip(eval ("c" + i));
i++;
}
this.stage_complete.gotoAndPlay("out");
playerstage++;
action = "start";
if (playerstage > 20) {
action = "game completed";
playerstage = 1;
}
storage.data.playerstage = playerstage;
return;
case "start" :
setup();
_root.levelname = "Stage " + playerstage;
action = "start cards";
return;
case "start cards" :
initcards();
action = "move cards in";
return;
case "move cards in" :
movecardsin();
return;
case "move matched cards" :
movematchedcards();
return;
case "match made delay" :
if (counter > 0) {
counter--;
} else {
movecards_snd.start();
cards_removed++;
a = eval ("c" + card1cardn).cardnumber;
eval ("c" + card1cardn).x = 520 + (cards_removed * 4);
eval ("c" + card1cardn).swapDepths(100 + cards_removed);
cards_removed++;
a = eval ("c" + card2cardn).cardnumber;
eval ("c" + card2cardn).swapDepths(100 + cards_removed);
eval ("c" + card2cardn).x = 520 + (cards_removed * 4);
eval ("c" + card1cardn).y = 400;
eval ("c" + card2cardn).y = 400;
eval ("c" + card1cardn).gotoAndPlay(20);
eval ("c" + card2cardn).gotoAndPlay(20);
action = "move matched cards";
}
return;
case "no match delay" :
if (counter > 0) {
counter--;
} else {
eval ("c" + card1cardn).gotoAndPlay(10);
eval ("c" + card2cardn).gotoAndPlay(10);
action = "nothing";
}
return;
case "nothing" :
if (cards_removed < playablecards) {
break;
}
action = "level complete";
}
}
function cardClass() {
}
cardClass.prototype = new MovieClip();
cardClass.prototype.onLoad = function () {
this.type.gotoAndStop(this.cnum);
};
cardClass.prototype.onEnterFrame = function () {
};
cardClass.prototype.onPress = function () {
var _local1 = _root;
if (this.cardnumber != _local1.card1cardn) {
if (_local1.cardspressed < 2) {
_local1.pressacard(this.cardnumber);
}
}
};
Object.registerClass("card", cardClass);
Frame 147
action = "start";
Frame 148
stop();
Instance of Symbol 181 MovieClip in Frame 148
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 149
gotoAndPlay (4);
Frame 177
stop();
Symbol 3 MovieClip Frame 10
stop();
Symbol 4 MovieClip Frame 1
stop();
Symbol 6 MovieClip Frame 1
_root.stop();
PercentLoaded = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
num = Math.floor(PercentLoaded / 8) + 1;
bar.gotoAndStop(num);
} else {
_root.play();
}
Symbol 6 MovieClip Frame 2
gotoAndPlay (1);
Symbol 38 MovieClip Frame 1
stop();
Symbol 43 MovieClip [card] Frame 1
stop();
Symbol 43 MovieClip [card] Frame 8
stop();
Symbol 43 MovieClip [card] Frame 16
gotoAndStop (1);
Symbol 43 MovieClip [card] Frame 27
stop();
Symbol 47 MovieClip [message] Frame 30
stop();
Symbol 64 MovieClip Frame 74
stop();
Symbol 68 Button
on (release) {
_root.playgame();
}
Symbol 72 Button
on (press) {
_root.gohottoplay();
}
Symbol 77 Button
on (release) {
_root.playgame();
}
Symbol 82 Button
on (release) {
_root.resetplayerstage();
}
Symbol 83 MovieClip Frame 30
stop();
Symbol 83 MovieClip Frame 41
stop();
Symbol 87 Button
on (press) {
getURL ("mailto:terrypaton1@bigpond.com?subject=Match", "_blank");
}
Symbol 108 Button
on (release) {
_root.press_yes();
}
Symbol 111 Button
on (release) {
_root.press_no();
}
Symbol 117 MovieClip Frame 10
stop();
Symbol 121 MovieClip Frame 10
stop();
Symbol 125 MovieClip Frame 10
stop();
Symbol 129 MovieClip Frame 10
stop();
Symbol 130 MovieClip Frame 1
stop();
Symbol 146 Button
on (press) {
_root.action = "next playerstage";
}
Symbol 147 Button
on (press) {
_root.action = "next stage";
}
Symbol 156 Button
on (press) {
_root.go_playagain();
}
Symbol 159 Button
on (press) {
_root.go_mainmenu();
}
Symbol 165 MovieClip Frame 1
stop();
Symbol 165 MovieClip Frame 2
if (_root.playerstage < 5) {
this.creature.gotoAndStop(1);
}
if ((_root.playerstage > 4) && (_root.playerstage < 11)) {
this.creature.gotoAndStop(2);
}
if ((_root.playerstage > 10) && (_root.playerstage < 16)) {
this.creature.gotoAndStop(3);
}
if (_root.playerstage > 15) {
this.creature.gotoAndStop(4);
}
Symbol 165 MovieClip Frame 45
stop();
Symbol 165 MovieClip Frame 60
this.gotoAndStop(1);
Symbol 165 MovieClip Frame 107
stop();
Symbol 165 MovieClip Frame 118
stop();
Symbol 172 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 13
this.gotoAndStop(1);
Symbol 172 MovieClip Frame 54
this.gotoAndStop(1);