Counters

Game development with Board Game Arena Studio
Post Reply
User avatar
cora89
Posts: 29
Joined: 14 June 2012, 20:29

Counters

Post by cora89 »

Hi,

I want to make a counter for player's token left in the player panel.
Player has a "player_nbTokenLeft" arg in the database where i worked on.
But it didn't refresh, it's not what i wanted.
So i tryed to use updatecounters BUT i don't understand how the example of gomoku works. :oops:
it's full of "case/end", "left join"... in the select query. Mine must be more simple : the id of the counter and its value.
I found nothing in the studio doc, so dou you have any simple example of that ?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Counters

Post by sourisdudesert »

Hi,

if you only have one counter:

Add the counter to your player panel:
http://en.doc.boardgamearena.com/Game_i ... .27s_panel

And afterwards use it as a standard game component:
_ get its value in your PHP getAllDatas()
_ set its initial value in your Javascript setup function
_ update it when a player place a token. Ex:
$('nbTokenLeft_'+notif.args.player_id).innerHTML = toint( $('nbTokenLeft_'+notif.args.player_id).innerHTML ) -1;
Post Reply

Return to “Developers”