September 2010
Beginner
384 pages
8h 49m
English
The strategy we'll use to build our deck is to create an array of possibilities, randomly choose one of those possibilities, and then remove that possibility as an option. Let's see how that works.
BuildDeck function, start off by declaring a few variables:function BuildDeck()
{
var totalRobots:int = 4; // we've got four robots to work with
var card:Object; // this stores a reference to a card
}
for(i=0; i<totalRobots; i++)
{
}
That loop will run four times because totalRobots is set to 4. Next, create an array called RobotParts that will house the names of the body parts we can knock off:
for(i=0; i<totalRobots; i++) { var aRobotParts:Array ...Read now
Unlock full access