Page 1 of 1

Dice animations and Stock

Posted: 18 September 2020, 15:01
by eoincos
Hi There

I was wondering if there was an easy way to integrate rolling dice animations and the Stock component. I'm hoping there's a way to animate between a few randomly chosen Stock types before ending at a specific Stock type.

I currently use Stock to hold all the dice a player has and Stock types to hold the faces of a dice. Using Stock is the easiest way to control all of this and show the dice pool to the user. The only problem I have is once I randomly roll the dice, I can't animate it to the user.

I've seen lots of great examples of how to animate dice rolls and card flips using things like CSS Keyframes and more. The problem I have is linking these roll animations with the animation Stock uses when showing items to a user.

https://boardgamearena.com/forum/viewto ... ice#p35593
https://boardgamearena.com/forum/viewto ... ion#p26198
https://boardgamearena.com/forum/viewto ... ard#p35487

The current code for this is obviously pretty straight forward:

Code: Select all

        updateDice: function( new_dice, player_id )
        {
            var hand = this.dice[player_id];

            for ( var i in new_dice) {
                var dice = new_dice[i];
                hand.addToStockWithId(dice.dice_slot, dice.dice_id);
            }
        },
Any help on thsi would be greatly appreciated. I'm a developer working on the Dice Summoners adaptation.

Cheers,
Eoin Cos