So in Cribbage I have this piece of code where nextPlayer can call nextPlayer again if your opponent can't play a card
States:
game.php NextPlayer
And this all works great, except for the fact that a player plays a card and doesn't realize it is still their turn if they don't read the banner. I would like to play the global jingle after every card is played AND it is active player.
States:
Code: Select all
30 => array(
"name" => "nextPlayer",
"description" => "",
"type" => "game",
"action" => "stNextPlayer",
"transitions" => array("playerTurn"=> 20, "nextPlayer"=> 30, "go"=>33, "ClearBoard"=> 35, "endGame" => 90)
Code: Select all
function stNextPlayer() {
$player_id = self::activeNextPlayer();
// if you can play you must play simple
if (self::playPossible($player_id)) {
self::giveExtraTime( $player_id );
$this->gamestate->nextState('playerTurn');
return;
}
// Else -- Why can't we play
....
// Did we say Go
if ($player_id == self::getGameStateValue('go_player_id'))
{
// turn it back over to that player
$this->gamestate->nextState('nextPlayer');
return;
}
...
}