Reversi tutorial - color problem

Game development with Board Game Arena Studio
Post Reply
User avatar
Badguizmo
Posts: 76
Joined: 11 October 2020, 14:27

Reversi tutorial - color problem

Post by Badguizmo »

Hello everyone.

I am stuck with a color problem.
I am currently at the end of the "Setup the initial game position" step.

Unfortunately I have the following error
Javascript error:
During pageload
Cannot read property 'color' of undefined
TypeError: Cannot read property 'color' of undefined
at Object.addTokenOnBoard (https://en.1.studio.boardgamearena.com: ... 2045:37:55)
at Object.setup (https://en.1.studio.boardgamearena.com: ... 2045:74:26)
at Object.completesetup (https://en.1.studio.boardgamearena.com: ... s:2:574069)
at https://studio.boardgamearena.com/1/six ... 10:2215:24
at _ce (https://en.1.studio.boardgamearena.com: ... js:8:12390)
at _37 (https://en.1.studio.boardgamearena.com: ... js:8:14010)
at https://en.1.studio.boardgamearena.com: ... js:8:14274
at _38 (https://en.1.studio.boardgamearena.com: ... js:8:14100)
at _81 (https://en.1.studio.boardgamearena.com: ... js:8:14199)
at _f6 (https://en.1.studio.boardgamearena.com: ... js:8:15985)
Script:
Url: https://studio.boardgamearena.com/1/six ... ble=212410
BGA version 201117-1445
U=2337642
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.3
It seems that it cannot access somehow at the property

Code: Select all

this.gamedatas.players[player].color
When I look on the database, the player_color is filled.

Do you have any clue ?

NB : I plan to develop the game "six". I started the reversi tutorial because it is very similar ;)

Thank you all.
Official BGA developper newb :oops:
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Reversi tutorial - color problem

Post by Tisaac »

The issue is not with color, it's with this.gamedatas.players[player].
Have you tried to console.log(this.gamedatas.players, player) to see what is happening ?
User avatar
Badguizmo
Posts: 76
Joined: 11 October 2020, 14:27

Re: Reversi tutorial - color problem

Post by Badguizmo »

ok, just found that I screwed up the case :oops:
I wrote

Code: Select all

//Get reversi board token
        $result['board'] = self::getObjectListFromDB("select board_x x, board_y y, board_player Player
                                                      from board
                                                      where board_player is not null");
in game.php (Player)

and called

Code: Select all

gamedatas.board[i].player
in .js (player)

I'm out :?

Thank you for the help :D
Official BGA developper newb :oops:
Post Reply

Return to “Developers”