Page 1 of 1

Reversi Tutorial - player colours

Posted: 07 April 2020, 17:07
by darrenr
I am working my way through the reversi tutorial and have come upon a stumbling block.

After I have generated and placed the first four starting pieces I noticed they all appear as the same colour (white).

I have ensured that the following line is in place:

Code: Select all

$default_colors = array("ffffff", "000000");
When i log out the colours in the addTokenOnBoard function from this.gamedatas.players[player].color I recieve the following two values (008000 and FF0000) (green and red). therefore this does not match up with the classes created in the .css file and the correct portion of the image is never shown.

Has anyone else come across this, or have any suggestions for what is going wrong.

Cheers,
Darren

Re: Reversi Tutorial - player colours

Posted: 07 April 2020, 18:14
by apollo1001
HI Darren

It sounds like you need to tweak the gameinfos.inc.php file as the line below would correlate with the colours you are seeing:

Code: Select all

'player_colors' => array( "ff0000", "008000", "0000ff", "ffa500", "773300" ),
Cheers
Adam

Re: Reversi Tutorial - player colours

Posted: 07 April 2020, 18:20
by darrenr
Thanks Adam,

That has fixed it :-).

The learning continues...

Re: Reversi Tutorial - player colours

Posted: 17 May 2020, 22:25
by Hornir91
Hi and thanks, apollo :).

Your tip also fixed my bug with reversi game not taking player colors from array. I had to define it in gameinfos :).