Showing additional counters in the player area

Game development with Board Game Arena Studio
Post Reply
User avatar
BrianHanechak
Posts: 7
Joined: 06 October 2012, 19:18

Showing additional counters in the player area

Post by BrianHanechak »

I'd like to add some additional information to the player area. I couldn't find any documentation or examples on how to do this -- can someone point me to them?

Also, is it possible to add an extra icon or indicator not associated with a number (such as a 'start player' marker?)

- Brian
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Showing additional counters in the player area

Post by sourisdudesert »

Hello Brian,

I'm going to add a paragraph on this on documentation.

In the meantime, you can check out how it is working on Gomoku to display an additional counter:

First, you write your HTML template for your game panels at the end of your TPL file:

Code: Select all

var jstpl_player_board = '\<div class="cp_board">\
    <div id="stoneicon_p${id}" class="gmk_stoneicon gmk_stoneicon_${color}"></div><span id="stonecount_p${id}">0</span>\
</div>';
Then, you add this piece of code in your JS file to add this template to each player panel:

Code: Select all

            // Setting up player boards
            for( var player_id in gamedatas.players )
            {
                var player = gamedatas.players[player_id];
                         
                // Setting up players boards if needed
                var player_board_div = $('player_board_'+player_id);
                dojo.place( this.format_block('jstpl_player_board', player ), player_board_div );
            }
And that's it! After that, you can use this HTML part of the game interface as any other part of your HTML interface in the main game area.

Cheers,
Post Reply

Return to “Developers”