Rolling Dice interaction

Sep 13, 2015

I am working on a board game where I have set up a dice with a random number generator. However I have a very demanding client who want the dice to simulate a rolling effect. Is there a way that jarva script could be written to make the dice roll through states then show the random number.

Please help...

12 Replies
Alexandros Anoyatis

Hi Sam,

You can achieve that with JS by following some simple steps.

1) Create a dice with all the states (normal (1), 2, 3, 4, 5.
2) Map states to a number variable (say dice1) - create 6 triggers in the form of Change state of dice to x when variable dice1 changes on condition that dice1(var) is 1, etc.
3) Create a layer (say roll dice 1) and execute a JS trigger to randomly select a number from 1 to 6 (seeĀ Storyline's JS practices for the code on how to achieve that). Make 10-15 copies of the JS trigger and use different time events to fire those actions - i.e. JS trigger 2 starts when timeline reaches 0.25 sec, trigger 3 at 0.5 sec, trigger 4 at .75, and so on.

Do the same for the second dice (using a different variable, this time dice2 and assign a 2nd layer for that dice.

Create an extra closing trigger (hide layer) on both layers in the end and uncheck the "hide other slide layers" option on both.

Then all you have to do is fire up(show) both layers at the same time when user presses a button.

Hope this helps,