Frame 1
function addtopten(prna, prsc) {
if (prsc >= toptena[9].sc) {
toptena.push({na:prna, sc:prsc});
toptena.sortOn("sc", 18);
toptena.pop();
i = 9;
while (i >= 0) {
if ((toptena[i].na == prna) && (toptena[i].sc == prsc)) {
return(i + 1);
}
i--;
}
} else {
return(-1);
}
}
sound_flag = true;
stop();
levels = 1;
user = "Player";
newat = 11;
toptena = [{na:"CPU", sc:1400}, {na:"CPU", sc:1200}, {na:"CPU", sc:1000}, {na:"CPU", sc:850}, {na:"CPU", sc:700}, {na:"CPU", sc:550}, {na:"CPU", sc:400}, {na:"CPU", sc:250}, {na:"CPU", sc:125}, {na:"CPU", sc:30}];
Instance of Symbol 19 MovieClip "MC_loader" in Frame 1
onClipEvent (enterFrame) {
gotoAndStop(_root.aa);
}
Frame 11
stop();
Frame 21
if (false) {
}
Frame 28
if (false) {
}
Frame 41
Frame 51
if (false) {
}
Symbol 19 MovieClip Frame 1
this.onEnterFrame = function () {
var _local2 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (_local2 >= 99) {
_root.gotoAndStop("start");
} else {
gotoAndStop(_local2);
}
};
stop();
Symbol 19 MovieClip Frame 100
stop();
Symbol 31 Button
on (release) {
getURL ("http://www.agame.com", "_blank");
}
Symbol 35 Button
on (release) {
_root.sound_flag = false;
stopAllSounds();
nextFrame();
}
Symbol 38 Button
on (release) {
_root.sound_flag = true;
prevFrame();
}
Symbol 39 MovieClip Frame 1
if (_root.sound_flag) {
stop();
} else {
gotoAndStop (2);
}
Symbol 43 Button
on (release) {
_quality = "MEDIUM";
nextFrame();
}
Symbol 46 Button
on (release) {
_quality = "LOW";
nextFrame();
}
Symbol 48 Button
on (release) {
_quality = "HIGH";
gotoAndStop (1);
}
Symbol 49 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 2
stop();
Symbol 49 MovieClip Frame 3
stop();
Symbol 51 Button
on (release) {
gotoAndStop ("game");
}
Symbol 53 Button
on (release) {
gotoAndStop ("help");
}
Symbol 59 Button
on (release) {
getURL ("http://www.game.com.cn", "_blank");
}
Symbol 80 Button
on (release) {
gotoAndStop ("highscores");
}
Symbol 82 Button
on (release) {
getURL ("http://www.agame.com", "_blank");
}
Symbol 84 Button
on (release) {
getURL ("http://en.agame.com/downloads/gamedownloads.html", "_blank");
}
Symbol 87 Button
on (release) {
getURL ("http://www.agame.com", "_blank");
}
Symbol 101 Button
on (release) {
gotoAndStop ("start");
}
Symbol 113 Button
on (press) {
this._parent._parent.ClickCard(this);
}
Symbol 132 MovieClip Frame 1
stop();
Symbol 135 MovieClip Frame 1
stop();
Symbol 147 MovieClip Frame 1
stop();
Symbol 163 Button
on (release) {
TraceCards();
MC_timer.timer_stop();
}
Symbol 164 Button
on (release) {
washAndShearched();
}
Symbol 165 Button
on (release) {
showTip();
}
Symbol 168 Button
on (release) {
btn_tip();
}
Symbol 171 Button
on (release) {
btn_change();
}
Symbol 180 MovieClip Frame 1
function timer_start(v_time) {
trace("starttime" + v_time);
all_time = v_time * 25;
now_time = all_time;
timer_state = 1;
this.onEnterFrame = function () {
now_time--;
MC_timer_bar._xscale = (now_time / all_time) * 100;
if (now_time <= 0) {
this.onEnterFrame = null;
_parent.gameover();
}
};
}
function timer_end() {
timer_state = 0;
this.onEnterFrame = null;
}
function timer_stop() {
timer_state = 0;
this.onEnterFrame = null;
}
function timer_goon() {
timer_state = 1;
this.onEnterFrame = function () {
now_time--;
MC_timer_bar._xscale = (now_time / all_time) * 100;
if (now_time <= 0) {
this.onEnterFrame = null;
_parent.gameover();
}
};
}
function timer_change() {
if (timer_state == 1) {
_parent.MC_cards._visible = false;
_parent.flag_stop = 1;
timer_stop();
} else {
_parent.flag_stop = 0;
_parent.MC_cards._visible = true;
timer_goon();
}
}
timer_start(_parent.game_time);
Symbol 182 Button
on (release) {
_parent._parent.sound_flag = false;
gotoAndStop ("off");
trace("sound_flag:" + _parent._parent.sound_flag);
}
Symbol 184 Button
on (release) {
_parent._parent.sound_flag = true;
gotoAndStop ("on");
trace("sound_flag:" + _parent._parent.sound_flag);
}
Symbol 186 MovieClip Frame 1
if (_parent._parent.sound_flag == true) {
gotoAndStop ("on");
} else {
gotoAndStop ("off");
}
trace("sound_flag:" + _parent._parent.sound_flag);
Symbol 186 MovieClip Frame 2
stop();
Symbol 191 Button
on (release) {
Timer_stop_goon();
}
Symbol 193 Button
on (release) {
_root.gotoAndStop("start");
}
Symbol 201 Button
on (release) {
_parent.nextLevel();
}
Symbol 204 MovieClip Frame 1
function Para() {
card_width = 45;
card_height = 48;
center_x = -20;
center_y = -10;
num_change = 3;
num_tip = 6;
score = 0;
level = _root.levels;
level_para = [{level:0, num_x:16, num_y:10, num_card:34, time:20}, {level:1, num_x:6, num_y:6, num_card:10, time:90}, {level:2, num_x:7, num_y:6, num_card:12, time:90}, {level:3, num_x:8, num_y:7, num_card:14, time:120}, {level:4, num_x:10, num_y:7, num_card:16, time:140}, {level:5, num_x:10, num_y:8, num_card:18, time:150}, {level:6, num_x:11, num_y:8, num_card:20, time:150}, {level:7, num_x:12, num_y:8, num_card:25, time:170}, {level:8, num_x:13, num_y:8, num_card:32, time:180}, {level:9, num_x:14, num_y:8, num_card:34, time:200}, {level:10, num_x:14, num_y:8, num_card:34, time:210}];
LevelPara();
}
function LevelPara() {
num_x = level_para[level].num_x;
num_y = level_para[level].num_y;
num_card = level_para[level].num_card;
game_time = level_para[level].time;
}
function win() {
trace("win");
MC_timer.timer_end();
var temp_mc = this.createEmptyMovieClip("win_manager", this.getNextHighestDepth());
temp_mc._frame = 20;
temp_mc.onEnterFrame = function () {
temp_mc._frame--;
if (temp_mc._frame == 0) {
win_widows._visible = true;
temp_mc.removeMovieClip();
}
};
}
function nextLevel() {
level++;
_root.levels++;
if (level >= level_para.length) {
_root.allscore = score;
_root.gotoAndStop("gameover");
} else {
LevelPara();
num_change = num_change + 1;
num_tip = num_tip + 2;
score = score + 100;
InitGame();
}
}
function gameover() {
SoundPlay("fail_sound.wav");
flag_stop = 1;
_root.allscore = score;
_root.gotoAndStop("gameover");
}
function InitGame() {
var _local5 = new Array();
num_left = num_x * num_y;
var _local2 = 1;
while (_local2 <= num_left) {
var _local7 = random(num_card) + 1;
_local5[_local2] = _local7;
_local5[_local2 + 1] = _local7;
_local2 = _local2 + 2;
}
card = new Array();
cardleft = new Array();
_local2 = 1;
while (_local2 <= num_card) {
cardleft[_local2] = new Array();
_local2++;
}
left_x = (((-card_width) * num_x) / 2) + center_x;
up_y = (((-card_height) * num_y) / 2) + center_y;
var _local8 = up_y;
_local2 = 1;
var _local3 = 1;
while (_local3 <= num_y) {
card[_local3] = new Array();
var _local9 = left_x;
var _local4 = 1;
while (_local4 <= num_x) {
var _local1 = _local5[_local2];
card[_local3][_local4] = {card:_local1, x:_local9, y:_local8, n:cardleft[_local1].length};
cardleft[_local1].push({Iscard:1, i:_local4, j:_local3});
_local2++;
_local9 = _local9 + card_width;
_local4++;
}
_local8 = _local8 + card_height;
_local3++;
}
card[0] = new Array();
card[num_y + 1] = new Array();
var _local9 = left_x - card_width;
_local8 = up_y - card_height;
var _local4 = 0;
while (_local4 <= (num_x + 1)) {
card[0][_local4] = {card:0, x:_local9, y:up_y - card_height};
card[num_y + 1][_local4] = {card:0, x:_local9, y:up_y + (card_height * (num_y + 1))};
_local9 = _local9 + card_width;
_local4++;
}
_local3 = 0;
while (_local3 <= (num_y + 1)) {
card[_local3][0] = {card:0, x:left_x - card_width, y:_local8};
card[_local3][num_x + 1] = {card:0, x:left_x + (card_width * (num_x + 1)), y:_local8};
_local8 = _local8 + card_height;
_local3++;
}
game_state = 0;
tip_mc1 = "";
tip_mc2 = "";
flag_stop = 0;
washAndShearched();
MC_timer.timer_start(game_time);
win_widows._visible = false;
}
function ShowCard() {
var _local5 = 1;
var _local3 = 0;
while (_local3 <= (num_y + 1)) {
var _local2 = 0;
while (_local2 <= (num_x + 1)) {
var _local4 = this.MC_cards.card_sample.duplicateMovieClip((("card" + _local3) + "_") + _local2, _local5++);
_local4._x = card[_local3][_local2].x;
_local4._y = card[_local3][_local2].y;
_local4.i = _local2;
_local4.j = _local3;
ShowACard(_local2, _local3, card[_local3][_local2].card);
_local2++;
}
_local3++;
}
this.MC_cards.card_sample._visible = false;
}
function ShowACard(v_i, v_j, v_card) {
var _local2 = this.MC_cards[(("card" + v_j) + "_") + v_i];
card[v_j][v_i].card = v_card;
_local2.gotoAndStop(card[v_j][v_i].card + 1);
}
function RefreshCard() {
var _local2 = 0;
while (_local2 <= (num_y + 1)) {
var _local1 = 0;
while (_local1 <= (num_x + 1)) {
ShowACard(_local1, _local2, card[_local2][_local1].card);
_local1++;
}
_local2++;
}
}
function ClickCard(v_mc) {
trace((((("click card i:" + v_mc.i) + " j:") + v_mc.j) + " card:") + card[v_mc.j][v_mc.i].card);
unshowTip();
if (game_state == 0) {
SoundPlay("click_sound.wav");
firstclick(v_mc);
} else if (v_mc == clicked_mc) {
noclick();
} else {
var _local2 = CanLine(v_mc.i, v_mc.j, clicked_mc.i, clicked_mc.j);
trace(_local2.flag);
if (_local2.flag == 1) {
SoundPlay("line_sound.wav");
DrawLine(_local2.pos1, _local2.pos2, 1);
DrawLine(_local2.pos2, _local2.pos3, 1);
DrawLine(_local2.pos3, _local2.pos4, 1);
KillCard(v_mc.i, v_mc.j);
KillCard(clicked_mc.i, clicked_mc.j);
if (num_left == 0) {
SoundPlay("win_sound.wav");
win();
} else if (Shearched() == 0) {
SoundPlay("change_sound.wav");
washAndShearched();
}
RefreshCard();
noclick();
} else {
noclick();
SoundPlay("click_sound.wav");
firstclick(v_mc);
}
}
}
function firstclick(v_mc) {
game_state = 1;
clicked_mc = v_mc;
clicked_mc.MC_click_flag.gotoAndStop("on");
}
function noclick() {
game_state = 0;
clicked_mc.MC_click_flag.gotoAndStop("off");
clicked_mc = null;
}
function washAndShearched() {
do {
washCard();
} while (!Shearched());
ShowCard();
}
function washCard() {
var _local2 = random(num_left) + num_left;
var _local1 = 1;
while (_local1 <= _local2) {
switchCard(random(num_x) + 1, random(num_y) + 1, random(num_x) + 1, random(num_y) + 1);
_local1++;
}
}
function switchCard(v_i1, v_j1, v_i2, v_j2) {
var _local5 = card[v_j1][v_i1].card;
card[v_j1][v_i1].card = card[v_j2][v_i2].card;
card[v_j2][v_i2].card = _local5;
_local5 = card[v_j1][v_i1].n;
card[v_j1][v_i1].n = card[v_j2][v_i2].n;
card[v_j2][v_i2].n = _local5;
cardleft[card[v_j1][v_i1].card][card[v_j1][v_i1].n] = {Iscard:1, i:v_i1, j:v_j1};
cardleft[card[v_j2][v_i2].card][card[v_j2][v_i2].n] = {Iscard:1, i:v_i2, j:v_j2};
}
function CanLine(v_i1, v_j1, v_i2, v_j2) {
trace((((((((((("\u6BD4\u8F83i" + v_i1) + "j:") + v_j1) + "card:") + card[v_j1][v_i1].card) + " \u548Ci:") + v_i2) + "j:") + v_j2) + "card:") + card[v_j2][v_i2].card);
if (card[v_j2][v_i2].card != card[v_j1][v_i1].card) {
return({flag:0});
}
var _local18 = Find4Side(v_i1, v_j1);
var _local17 = Find4Side(v_i2, v_j2);
trace((((((("up:" + _local18.up) + " down:") + _local18.down) + " left:") + _local18.left) + " right:") + _local18.right);
trace((((((("up:" + _local17.up) + " down:") + _local17.down) + " left:") + _local17.left) + " right:") + _local17.right);
tempcard1 = card[v_j1][v_i1].card;
tempcard2 = card[v_j1][v_i1].card;
card[v_j1][v_i1].card = 0;
card[v_j2][v_i2].card = 0;
var _local6 = Math.max(_local18.up, _local17.up);
var _local5 = Math.min(_local18.down, _local17.down);
var _local15 = _local6;
while (_local15 <= _local5) {
var _local20 = Math.min(v_i1, v_i2);
var _local19 = Math.max(v_i1, v_i2);
var _local21 = 1;
var _local16 = _local20;
while (_local16 <= _local19) {
if (card[_local15][_local16].card != 0) {
_local21 = 0;
break;
}
_local16++;
}
if (_local21 == 1) {
trace("n\u578B");
card[v_j1][v_i1].card = tempcard1;
card[v_j2][v_i2].card = tempcard2;
var _local8 = {i:_local20, j:((_local20 == v_i1) ? (v_j1) : (v_j2))};
var _local10 = {i:_local20, j:_local15};
var _local9 = {i:_local19, j:_local15};
var _local7 = {i:_local19, j:((_local19 == v_i2) ? (v_j2) : (v_j1))};
return({flag:1, pos1:_local8, pos2:_local10, pos3:_local9, pos4:_local7});
}
_local15++;
}
var _local20 = Math.max(_local18.left, _local17.left);
var _local19 = Math.min(_local18.right, _local17.right);
var _local16 = _local20;
while (_local16 <= _local19) {
_local6 = Math.min(v_j1, v_j2);
_local5 = Math.max(v_j1, v_j2);
var _local21 = 1;
_local15 = _local6;
while (_local15 <= _local5) {
if (card[_local15][_local16].card != 0) {
_local21 = 0;
break;
}
_local15++;
}
if (_local21 == 1) {
trace("z\u578B");
card[v_j1][v_i1].card = tempcard1;
card[v_j2][v_i2].card = tempcard2;
var _local8 = {i:((_local6 == v_j1) ? (v_i1) : (v_i2)), j:_local6};
var _local10 = {i:_local16, j:_local6};
var _local9 = {i:_local16, j:_local5};
var _local7 = {i:((_local5 == v_j2) ? (v_i2) : (v_i1)), j:_local5};
return({flag:1, pos1:_local8, pos2:_local10, pos3:_local9, pos4:_local7});
}
_local16++;
}
card[v_j1][v_i1].card = tempcard1;
card[v_j2][v_i2].card = tempcard2;
return({flag:0});
}
function DrawLine(pos1, pos2, line_colour) {
var MC_line = this.MC_cards.createEmptyMovieClip("line" + this.MC_cards.getNextHighestDepth(), this.MC_cards.getNextHighestDepth());
var ran_colour = line_colour;
var i1 = pos1.i;
var i2 = pos2.i;
var j1 = pos1.j;
var j2 = pos2.j;
var tempcard1 = this.MC_cards[(("card" + j1) + "_") + i1];
var tempcard2 = this.MC_cards[(("card" + j2) + "_") + i2];
with (MC_line) {
switch (ran_colour) {
case 1 :
lineStyle(5, 16750848, 100);
break;
case 2 :
lineStyle(5, 11861622, 100);
break;
case 3 :
lineStyle(5, 16711935, 100);
break;
case 4 :
lineStyle(5, 65535, 100);
break;
default :
lineStyle(5, 6711039, 100);
}
moveTo(tempcard1._x + 18, tempcard1._y + 28);
lineTo(tempcard2._x + 18, tempcard2._y + 28);
_state = 8;
}
MC_line.onEnterFrame = function () {
_state--;
if (_state <= 0) {
MC_line.removeMovieClip();
}
};
}
function Find4Side(v_i, v_j) {
var _local7 = v_j;
var _local5 = v_j;
var _local8 = v_i;
var _local6 = v_i;
var _local1 = v_j - 1;
while (_local1 >= 0) {
if (card[_local1][v_i].card != 0) {
_local7 = _local1 + 1;
break;
}
_local7 = 0;
_local1--;
}
_local1 = v_j + 1;
while (_local1 <= (num_y + 1)) {
if (card[_local1][v_i].card != 0) {
_local5 = _local1 - 1;
break;
}
_local5 = num_y + 1;
_local1++;
}
var _local2 = v_i - 1;
while (_local2 >= 0) {
if (card[v_j][_local2].card != 0) {
_local8 = _local2 + 1;
break;
}
_local8 = 0;
_local2--;
}
_local2 = v_i + 1;
while (_local2 <= (num_x + 1)) {
if (card[v_j][_local2].card != 0) {
_local6 = _local2 - 1;
break;
}
_local6 = num_x + 1;
_local2++;
}
return({up:_local7, down:_local5, left:_local8, right:_local6});
}
function KillCard(v_i, v_j) {
trace((("kill i:" + v_i) + " j:") + v_j);
cardleft[card[v_j][v_i].card][card[v_j][v_i].n].Iscard = 0;
AddOneScore();
ShowACard(v_i, v_j, 0);
num_left--;
}
function ShearchCardPair() {
var _local5 = 1;
while (_local5 <= num_card) {
var _local7 = cardleft[_local5].length;
var _local4 = 0;
while (_local4 < _local7) {
var _local1 = _local4 + 1;
while (_local1 < _local7) {
trace((("n1:" + _local4) + " n2:") + _local1);
var _local3 = cardleft[_local5][_local4];
var _local2 = cardleft[_local5][_local1];
if ((_local3.Iscard == 1) && (_local2.Iscard == 1)) {
var _local6 = CanLine(_local3.i, _local3.j, _local2.i, _local2.j);
if (_local6.flag == 1) {
return({flag:1, point1:_local3, point2:_local2});
}
}
_local1++;
}
_local4++;
}
_local5++;
}
return({flag:0});
}
function Shearched() {
var _local1 = ShearchCardPair();
if (_local1.flag == 1) {
var _local3 = _local1.point1;
var _local2 = _local1.point2;
tip_mc1 = (("card" + _local3.j) + "_") + _local3.i;
tip_mc2 = (("card" + _local2.j) + "_") + _local2.i;
return(1);
}
return(0);
}
function showTip() {
this.MC_cards[tip_mc1].MC_hit_flag.gotoAndStop("on");
this.MC_cards[tip_mc2].MC_hit_flag.gotoAndStop("on");
}
function unshowTip() {
this.MC_cards[tip_mc1].MC_hit_flag.gotoAndStop("off");
this.MC_cards[tip_mc2].MC_hit_flag.gotoAndStop("off");
}
function btn_tip() {
if ((flag_stop == 0) && (num_tip > 0)) {
if (_root.sound_flag) {
SoundPlay("tip_sound.wav");
}
num_tip--;
showTip();
}
}
function btn_change() {
if ((flag_stop == 0) && (num_change > 0)) {
if (_root.sound_flag) {
SoundPlay("change_sound.wav");
}
num_change--;
washAndShearched();
}
}
function AddOneScore() {
score++;
}
function Timer_stop_goon() {
MC_timer.timer_change();
}
function SoundPlay(v_sound_name, v_num, v_volume, v_start_second) {
if (_root.sound_flag) {
soundmanager_gamesound = new Sound();
soundmanager_gamesound.attachSound(v_sound_name);
if (v_volume != undefined) {
soundmanager_gamesound.setVolume(v_volume);
}
soundmanager_gamesound.start(v_start_second, v_num);
return(soundmanager_gamesound);
}
}
function SoundStop(v_sound_name) {
soundmanager_gamesound.stop(v_sound_name);
}
function TraceCards() {
function checkgood() {
var _local4 = 0;
var _local3 = 1;
while (_local3 <= num_card) {
var _local5 = cardleft[_local3].length;
var _local1 = 0;
while (_local1 < _local5) {
if (cardleft[_local3][_local1].Iscard == 1) {
_local4 = (card[cardleft[_local3][_local1].j][cardleft[_local3][_local1].i].card != _local3) || (card[cardleft[_local3][_local1].j][cardleft[_local3][_local1].i].n != _local1);
if (_local4) {
return((("bad1card" + _local3) + " n") + _local1);
}
}
_local1++;
}
_local3++;
}
_local4 = 0;
var _local2 = 1;
while (_local2 <= num_y) {
var _local1 = 1;
while (_local1 <= num_x) {
if (cardleft[card[_local2][_local1].card][card[_local2][_local1].n].Iscard) {
_local4 = (cardleft[card[_local2][_local1].card][card[_local2][_local1].n].i != _local1) || (cardleft[card[_local2][_local1].card][card[_local2][_local1].n].j != _local2);
if (_local4) {
return((("bad2" + _local1) + " ") + _local2);
}
}
_local1++;
}
_local2++;
}
return("good");
}
var _local2 = 0;
while (_local2 <= (num_y + 1)) {
var _local5 = "";
var _local1 = 0;
while (_local1 <= (num_x + 1)) {
_local5 = _local5 + (" " + card[_local2][_local1].card);
_local1++;
}
trace(_local5);
_local2++;
}
trace(checkgood());
}
Para();
InitGame();
Symbol 209 Button
on (release) {
gotoAndStop ("start");
}
Symbol 213 Button
on (release) {
newat = addtopten(user, allscore);
levels = 1;
gotoAndStop ("highscores");
}
Symbol 222 MovieClip Frame 15
stop();
Symbol 224 MovieClip Frame 1
stop();
Symbol 258 MovieClip Frame 1
i = 0;
while (i < 10) {
this["name" + (i + 1)] = _root.toptena[i].na;
this["sc" + (i + 1)] = _root.toptena[i].sc;
i++;
}
Instance of Symbol 224 MovieClip "topnew" in Symbol 258 MovieClip Frame 1
onClipEvent (load) {
if (_root.newat == -1) {
gotoAndStop (11);
} else {
gotoAndStop(_root.newat);
}
}
Symbol 259 Button
on (release) {
newat = 11;
gotoAndStop ("start");
}