la
yo si te lo doy...ja
tuve problemas para encontrarlo y estaba en apuros pero aqui lo tengo...
...aprovenchenlo
/*
* Function createDeck -
* creates an array to serve as a sorted card model
*/
function createDeck() {
// create cards
startDeck = new Array();
// each card = it's array position + 1
for (x=0;x<picCount;x++) {
startDeck
}
return startDeck;
}
/*
* Function shuffle - when given a deck of N cards (array) the
* shuffle will return a deck of N cards with the same elements
* of the given deck in random order
*/
function shuffle(deckOld) {
// creating the deck we will return
deck = new Array();
// fill array of cards with unique pics
do {
//*** NOT INDENTED FOR WEB PAGE PURPOSES ***
newRandom = Math.floor(deckOld.length*Math.random());
deck.push(deckOld[newRandom]);
// copy array
scanData = new Array();
scanData = scanData.concat(deck);
// if last added was duplicate, than remove.
if (scanData.sort(Array.UNIQUESORT) == 0) {
deck.pop();
}
} while (deck.length<deckOld.length);
// return the finished array
return deck;
}
/*
* Function deal - takes the cards and deals them out onto
* the screen. Supply unique picture number and uPic*2 cards
* are delt upon the screen.
*
* Parameters:
* uPic = number of unique pictures to deal
* deck of cards to deal it from (all pictures)
*/
function deal(uPic, cardDeck) {
moveY = 1;
moveX = 1;
// go to next row after rowBreak cards are delt.
rowBreak = 8;
//initialize decks
deck1 = new Array();
deck2 = new Array();
// shuffle full deck
deck1 = shuffle(cardDeck);
// take only the number of cards needed.
deck1 = deck1.slice(0,uPic);
// deck 2 is shuffled cards of deck1
deck2 = shuffle(deck1);
// lay out twice the uniques for duplication.
for (icount=0; icount<(2*uPic); icount++) {
//*** NOT INDENTED FOR WEB PAGE PURPOSES ***
curName = "pc"+icount;
moveX = (icount%rowBreak)+1;
duplicateMovieClip(_root.pCard, curName, icount);
// need eval since curName is only a string
// and not an object pointer
with (eval(curName)) {
// position the card
_x = (moveX-1)*110+15;
_y = 150*moveY-125;
// now pick the picture for the card
// curPicNum is from deck1 if odd and deck2 if even
curPicNum = (icount % 2 == 0) ? (deck2.pop()) : (deck1.pop());
theCard.cardFace.gotoAndStop(curPicNum);
}
if ((icount+1)%rowBreak == 0) {
moveY++;
}
}
}
// increase number of cards in play
_root.cardsInPlay++;
// if one card is in play then hold
// if 2 are in play then check for correctness
if (_root.cardsInPlay == 1) {
gotoAndPlay("holdDown");
} else if (_root.cardsInPlay == 2) {
// check for correctness race condition here
if (_root.card2Match == cardFace._currentframe) {
gotoAndPlay("correctMatch");
} else {
_root.card2Match = "";
}
}
// remove this card from being in play.
_root.cardsInPlay--;
// return to the beginning.
gotoAndStop("cardTurn");
// remove this card from being in play.
_root.cardsInPlay--;
// one less number of total cards
_root.totalCardsNum--;
// check if game is over
if (_root.totalCardsNum == 0) {
_root.gotoAndPlay("Ender");
stop();
} else {
stop();
}
on (release) {
// only animate 2 unique cards at any given time.
if ((_root.cardsInPlay < 2) && (this.theCard._currentframe <= 1))
{
// if this is the first card then save picture number
//*** NOT INDENTED FOR WEBPAGE PURPOSES ***
if (_root.cardsInPlay == 1) {
_root.card2Match = this.theCard.cardFace._currentframe;
}
// begin animating
this.theCard.play();
// count attempt
_root.attemptCount++;
_root.gameAttempts = "ATTEMPTS: "
+ Math.round(_root.attemptCount / 2);
}
}
// create a deck
fullDeck = new Array();
fullDeck = createDeck();
// Total unique cards
totalUniqueCards = 16;
// Total number of cards in play
totalCardsNum = totalUniqueCards * 2;
// deal the cards + duplicates from the deck
deal(totalUniqueCards, fullDeck);
// wait here now.
stop();
onClipEvent(load) {
staticPrefix = "TIMER: ";
startTime = getTimer();
staticSuffix = " seconds";
}
onClipEvent(enterFrame) {
curTime = getTimer();
elapsed = curTime - startTime;
_root.secondsElapsed = Math.floor(elapsed / 1000);
//trace(secondsElapsed);
this.gameTime = staticPrefix +
_root.secondsElapsed + staticSuffix;
}
// make sure someone didn't cheat with right mouse click
if (_root.totalCardsNum != 0) {
gotoAndPlay("beginning");
}
// get peices
seconds = _root.secondsElapsed;
numAttempts = Math.floor(_root.attemptCount / 2)
// now print scoring
sumText = "You took " + seconds
+ " seconds to complete this game.\nYou did so in "
+ numAttempts + " attempts.\n\nYour final score is: "
_root.summary = sumText;
_root.finalScore = seconds * numAttempts;
// stop stage
stop();
para mas detalles consulta
http://www.bleacheatingfreaks.com/flash/games/memory/