September 2011
Beginner
408 pages
9h 52m
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(j=0; j<cols; j++)
{
aGrid[i][j] = new Card();
}to this:
for(j=0; j<cols; j++)
{
var someNum:int = Random.Range(0,aCards.length);
aGrid[i][j] = aCards[someNum];
aCards.RemoveAt(someNum);
}
This code ...
Read now
Unlock full access