Flash Challenge.getPlayerStatus()

From J2Play

Jump to: navigation, search

Contents

Description

Get the status of the player

Syntax

public function getPlayerStatus(index: Number) : Number;

Parameters

* @param index of player

Return Value

@return number represent status
 possible return value
 private static var PLAYER_STATUS_NULL = 0;     // player doesn't start
 private static var PLAYER_STATUS_ACCEPT = 1;   // player accepts challenge
 private static var PLAYER_STATUS_DECLINE = 2;  // player declines challenge
 private static var PLAYER_STATUS_PLAYING = 3;  // player is playing
 private static var PLAYER_STATUS_WAITING = 4;  // player is waiting next turn
 private static var PLAYER_STATUS_FINISHED = 5; // player finished his game

Examples

Get current player status before you call updateGameStart(), it shouldn't be PLAYER_STATUS_PLAYING and PLAYER_STATUS_FINISHED.

  if (challenge.getPlayerStatus(challenge.getMyIndex())==PLAYER_STATUS_PLAYING)
  {
     gotoAndPlay('reenter game');
  }
Personal tools