September 2010
Beginner
384 pages
8h 49m
English
To compare the IDs, we need to make some changes to the FlipCardFaceUp function.
function FlipCardFaceUp(card:Object)
{
card.isFaceUp = true;
if(aCardsFlipped.IndexOf(card) < 0)
{
aCardsFlipped.Add(card);
if(aCardsFlipped.Count == 2)
{
playerCanClick = false;
yield WaitForSeconds(1);
if(aCardsFlipped[0].id == aCardsFlipped[1].id)
{
// Match!
aCardsFlipped[0].isMatched = true;
aCardsFlipped[1].isMatched = true;
}
else
{
aCardsFlipped[0].isFaceUp = false;
aCardsFlipped[1].isFaceUp = false;
}
aCardsFlipped = new ArrayList();
playerCanClick = true;
}
}
}
Here, we check to see if the two flipped-over cards have the same ID value. ...
Read now
Unlock full access