September 2011
Beginner
408 pages
9h 52m
English
Let's revisit our card-creation code and give each card an ID number. We'll use that number to detect matches.
BuildDeck function, add this line:function BuildDeck()
{
var totalRobots:int = 4; // we've got four robots to work with
var card:Object; // this stores a reference to a card
var id:int = 0;
id value to the Card class with each robot and missing body part card, and then increment the ID number: card = new Card("robot" + (i+1) + "Missing" + theMissingPart,
id);
aCards.Add(card);
card= new Card("robot" + (i+1) + theMissingPart, id);
aCards.Add(card);
id++;
id as a property of the Card class. Accept id as an argument in the Card class constructor function, ...Read now
Unlock full access