September 2010
Beginner
384 pages
8h 49m
English
Because we're passing a new argument to the Card class, we have to modify Card to accept it.
Card class code from this:class Card extends System.Object
{
// (variables omitted for clarity)
function Card()
{
img = "robot";
}
}
to this:
class Card extends System.Object
{
// (variables omitted for clarity)
function Card(img:String)
{
this.img = img;
}
}
Start function where we added all our new cards to the aGrid array. Change it from this:for(var j:int=0; j<cols; j++)
{
aGrid[i][j] = new Card();
}
to this:
for(var j:int=0; j<cols; j++)
{
var someNum:int = Random.Range(0,aCards.length);
aGrid[i][j] = aCards[someNum];
aCards.RemoveAt(someNum);
}
Read now
Unlock full access