Game Development Reference
In-Depth Information
else {
if ( gs.getSenderId() ==
m_pulse.getMyAvatar().getId() ) {
m_mgr.toMyHand(cid);
var card:Card;
card = m_mgr.getCardInHand(cid);
card.gameState = gameState;
refreshCards();
getCard();
}
else {
m_mgr.toOthers(cid);
}
}
}
Playing the game
Upon the player's turn, we add a countdown timer. The player must make a move
before the timer runs out. If the timer runs out, a card is played or discarded randomly.
public function onPlayerTurn():void {
if ( m_endRound )
return;
addChild(m_countDown);
m_countDown.start(10); // 10 seconds
m_mgr.traceCount();
}
If the player plays or discards a card, the _playCard is called. The listing is
shown below:
private function _playCard(c:Card,
discard:Boolean):Boolean {
if ( !m_pulse.isMyTurn() )
return false;
var d:Boolean
var canPlay:Boolean = true;
var f:Frog;
f = getFrogWithColor(c.color);
if ( !discard ) {
if ( f.step == 0 && c.value == -1 ) {
canPlay = false;
}
if ( f.step >= 9 && c.value == 1 ) {
 
Search WWH ::




Custom Search