Flash Challenge.updateNextTurn()

From J2Play

Jump to: navigation, search

Contents

Description

At end of player's turn, update challenge status and notify challenge system to let next player start his turn.

Syntax

public function updateNextTurn(
  nextPlayer: Number,
  finish : Boolean
);

Parameters

* @param nextPlayer the index of next player, challenge system will permit him to make his turn. It can be -1 if everybody finish the game.
* @param finish true if this player is finish his game, then this function will update all the display_messages and results to challenge system. If player just finish a turn, pass in false.

Return Value

N/A

Examples

In a two players challenge, update one player's turn and start next turn

if(challenge.isChallenge()) {
  var index=challenge.getMyIndex();
  challenge.updateNextTurn(index?0:1,true);
  // do other challenge related cleanup
}
Personal tools