Hello,
I'm experiencing some trouble to find out how to display the hands of my players to each other.
In my game, player hands are not hidden (only the first card) so I wanted to display those cards on the board for every player to see them.
I managed to place each players hand in the right spots of my board but couldn't have the hands to be seen in all screens. Each player can only see his cards on his spot.
My other stocks are correctly displayed to all players at the same time (see the screenshots).
Any tips or advices would be very appreciated
example:
player 1:

player 3:

here's my code for deck creation :
and my code for stock creation :
I'm experiencing some trouble to find out how to display the hands of my players to each other.
In my game, player hands are not hidden (only the first card) so I wanted to display those cards on the board for every player to see them.
I managed to place each players hand in the right spots of my board but couldn't have the hands to be seen in all screens. Each player can only see his cards on his spot.
My other stocks are correctly displayed to all players at the same time (see the screenshots).
Any tips or advices would be very appreciated
example:
player 1:

player 3:

here's my code for deck creation :
Code: Select all
// create weapond cards
$wcards = array();
for($color = 1; $color <= 5; $color++ )
{
for($value = 1; $value <= 7; $value++ ){
$wcards [] = array ('type' => $color, 'type_arg' => $value, 'nbr' => 1);
}
}
$this->weapon_card->createCards( $wcards, 'deck' );
$this->weapon_card->shuffle('deck');
$players = self::loadPlayersBasicInfos();
foreach($players as $player_id => $player){
$wcards = $this->weapon_card->pickCards(1,'deck', $player_id);
// todo : remember that this card is hidden
}
foreach($players as $player_id => $player){
$wcards = $this->weapon_card->pickCards(1,'deck', $player_id);
}
Code: Select all
this.playerHand = new ebg.stock(); // new stock object for hand
this.playerHand.create(this, $('playerTableCard_' + this.player_id), this.wcard_width, this.wcard_height);
this.playerHand.image_items_per_row = 7; // 7 images per row
dojo.connect( this.playerHand, 'onChangeSelection', this, 'onPlayerHandSelectionChanged');
// create card types:
for(var color = 1; color <= 5; color++){
for(var value = 1; value <= 7; value++)
{
// build card type id
var card_type_id = this.getCardUniqueId(color,value);
this.playerHand.addItemType(card_type_id, card_type_id, g_gamethemeurl + 'img/wcards.png', card_type_id);
}
}
// cards in player hand
for( var i in this.gamedatas.hand){
var card = this.gamedatas.hand[i];
var color = card.type;
var value = card.type_arg;
this.playerHand.addToStockWithId(this.getCardUniqueId(color,value),card.id);
}
this.playerHand.centerItems = true;
this.playerHand.setOverlap(50,0);