Diving into code, need some assistance

Game development with Board Game Arena Studio
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Diving into code, need some assistance

Post by Tisaac »

Conardist wrote: 02 January 2021, 09:40
Madmartigan007 wrote: 29 December 2020, 22:49
/*uncommenting this fails, dont know why

if (!self::isPlayerZombie(self::getActivePlayerId())) {
self::throwDice();

$dice_thrown = self::getCurrentRoundDice();

self::notifyAllPlayers("diceThrown", '', array(
'dice' => $dice_thrown,
'is_reroll' => false,
));
*/
Perhaps the last section you have a comma after false but no more array info - so remove the last comma?

Like this:

self::notifyAllPlayers("diceThrown", '', array(
'dice' => $dice_thrown,
'is_reroll' => false
));
No, that's totally valid syntax in most languages now, and very convenient .
User avatar
Madmartigan007
Posts: 10
Joined: 26 December 2020, 19:09

Re: Diving into code, need some assistance

Post by Madmartigan007 »

Game: Sutakku

Hello all, progress is steady and I am looking to try to take this to the next step.
I finished 75% of the PHP main class for basic stuff. Game starts with an autoroll of 3 dice out of 12. I have that working and data stored in the database. Next is for user to "select" 2 or 3 of these dice. I believe took care of the php database side. I can really use some help trying to get a simple visual of the 3 dice that the user can select from.

I have the sprites created and the css based on examples. I have the board showing on the screen.

I am trying to figure out the steps so that the user gets prompted to select some dice and continue. All actions are created. Been looking at many examples, just need a little push. If anyone has a sometime and can send me a message to possibly just discuss it on discord or here it would be appreciated.

I'm currently studying the BGA cookbook
User avatar
KuWizard
Posts: 329
Joined: 24 May 2018, 14:10

Re: Diving into code, need some assistance

Post by KuWizard »

Hi! I am a developer of the Martian Dice code you use.
Please be aware that this is my first project at BGA and I am not proficient at all at writing clean and concise code :)
But anyway, I'm flattered to have a project to be used as a base even if this is a coincidence :)
User avatar
AmadanNaBriona
Posts: 48
Joined: 17 March 2018, 18:52

Re: Diving into code, need some assistance

Post by AmadanNaBriona »

Madmartigan007 wrote: 02 January 2021, 17:39
I am trying to figure out the steps so that the user gets prompted to select some dice and continue. All actions are created. Been looking at many examples, just need a little push. If anyone has a sometime and can send me a message to possibly just discuss it on discord or here it would be appreciated.
One way to do it:

in your js file:

Code: Select all

        onUpdateActionButtons: function( stateName, args )
        {
                      
            if( this.isCurrentPlayerActive() ) {
                switch( stateName ) {
 
                 case 'selectDice':
                    this.addDiceToSelect();
                    break;
             }
	}
Your addDiceToSelect function should create action buttons which will display the dice the user selects. You will have to have some way of determining which dice those are, most likely through a subscribed notify function that sets a client state variable.
Post Reply

Return to “Developers”