There are a few ways you could extend this project.
This project has just used the A and B buttons for selecting dice. That limits what we can do. However the CLUE has touchpads as well. If we used them we could make a more complex interface. One possibility would be to support selecting multiple groups of dice. E.g. 1d2 + 2d4. We might add a modifier to that to support things like 1d10 + 2d4 + 6.
Another possibility is to make the motion trigger more advanced. In addition to a basic shake, maybe slamming the CLUE (gently) on the table could automatically roll 1d20 (probably the most common roll) regardless of what was selected.
To take it in a different direction, consider that the code doesn't try to model the physics of a tumbling die at all. It blindly generates random numbers. One step to improve this would be to ensure that it won't generate the same number two times in a row. This would make the visual effect better as well: each step in the roll would be more likely to be a different number. This would be especially noticeable when rolling a single die.
These are a few ways to expand on the code in this guide. If you come up with an interesting extension, bring it to our weekly Show and Tell and share it with the community.
Text editor powered by tinymce.