Forum Discussion
Rolling Dice interaction
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,
Alex