Game Development Reference
In-Depth Information
public function CardManager(game:Game)
{
m_game = game;
// build up the deck
makeCards(-1, Color.BLUE, Asset.getBlueMinus(), 2);
makeCards(1, Color.BLUE, Asset.getBluePlus(), 4);
makeCards(2, Color.BLUE, Asset.getBluePlusPlus(), 1);
makeCards(-1, Color.RED, Asset.getRedMinus(), 2);
makeCards(1, Color.RED, Asset.getRedPlus(), 4);
makeCards(2, Color.RED, Asset.getRedPlusPlus(), 1);
makeCards(-1, Color.GREEN, Asset.getGreenMinus(), 2);
makeCards(1, Color.GREEN, Asset.getGreenPlus(), 4);
makeCards(2, Color.GREEN, Asset.getGreenPlusPlus(), 1);
makeCards(-1, Color.PURPLE, Asset.getPurpleMinus(), 2);
makeCards(1, Color.PURPLE, Asset.getPurplePlus(), 4);
makeCards(2, Color.PURPLE, Asset.getPurplePlusPlus(), 1);
makeCards(-1, Color.YELLOW, Asset.getYellowMinus(), 2);
makeCards(1, Color.YELLOW, Asset.getYellowPlus(), 4);
makeCards(2, Color.YELLOW, Asset.getYellowPlusPlus(), 1);
shuffle();
// create the color cards
var cc:ColorCard;
cc = new ColorCard(Color.BLUE, Asset.getBlue());
m_colors.push(cc);
cc = new ColorCard(Color.RED, Asset.getRed());
m_colors.push(cc);
cc = new ColorCard(Color.GREEN, Asset.getGreen());
m_colors.push(cc);
cc = new ColorCard(Color.PURPLE, Asset.getPurple());
m_colors.push(cc);
cc = new ColorCard(Color.YELLOW, Asset.getYellow());
m_colors.push(cc);
}
public function traceCount():void {
trace("Deck: " + m_deck.length);
trace("MyHand: " + m_myHand.length);
trace("Others: " + m_others.length);
}
public function shuffle():void {
var i:int;
var card:Card;
 
Search WWH ::




Custom Search